Scripting a new record in a related table, keeps overwriting original?
Was wondering if anyone sees the (probably simple) mistake in my script logic below? I am trying to have a button on my "Estimate" layout create a new record in a table "Quote" based on two fields in the current Estimate layout/table.
When I create a new estimate, is it assigned an Estimate ID. I want vendors to bid on that estimate, by creating a quote to send them. So I have 1 field called quote_vendor_lookup(to enter Vendor code) and 1 button (to create the related quote) on the estimate record that allows a user to create a quote after entering the Vendor code. The quote should be unique for each esimtate_id + vendor code combination. I have this working, but only for the first time i use the button. Once I go back and try to enter a new quote for a different vendor (based on the same estimate) it simply overwrites the record I just created. This is strange because I am saying "new record" in the script below, or at least I think I am. IS it possible the new record does not mean new record in the quote table? (there is no way to specify an outside table for new record, that I see).
I have looked through all the script options but must be missing something, as the Estimate/Vendor Code combination shuld be unique and create a new record, not overwrite the old one.
Here is my "Create New quote" script for the button on the Estimate Form:
Create New Quote
Go to Layout [ “Quote” (Quote) ]
Set Field [ Quote::vendor_code; Quote::vendor_code = Estimate::quote_vendor_lookup ]
Set Field [ Quote::quote_id; Quote::quote_id = Estimate::estimate_id ]
[ Skip data entry validation; No dialog ]
As I said, this only works the first time, then it just overwrites the first record the second time. Maybe this has to do with my actual database table fields and not the script?
Any pointers would be great.