not 100% following your business logic here but you should capture the field values into variables first prior to the new records step. Then set the fields in the new record with those variables.
I "think" the data I need is captured before creating the record, but maybe it's not.
The quote should be created based on two fields in Estimate. 1- estimate_id and 2-vendor_code
I believe those are both present when I click the "Create new Quote" button.
I'll include a better description of the business logic below, in case it helps:
Each estimate has an assigned estimate_id. For example sake, let's use use Estimate 10019. I want my button to create to create quote requests for this estimate each time I use it, for different vendors (for example we will use two vendors-let's say vendor code "abc" and "def").
There is a field on the estimate form that says "Enter Vendor ID" followed by the button to create a quote. After entering vendor code "abc" I want the button to create a new quote with quote_id = 10019 and the vendor code = abc. That is the only quote I can create for that combination.
Now I go back to estimate 10019, and want to create a quote request for vendor "def". I enter "def" in the "Enter Vendor ID" field, and click the button to create new quote. This should create a NEW quote with quote_id=10019 and vendor code = def.
In the quote table, I use a field that concatenates quote_id and vendor code to store a unique value (such as 10019abc), that way only one quote can be created per estimate/vendor.
Hope this helps.
One thing I have noticed using the "data watcher" while running my script:
The values for each field I am trying to set in the quote table keep getting set to "1"
Even though I am specifiying they be set to current fields in the estimate form.
My script uses:
Set Field[Quote::vendor_code; Quote:vendor_code=Estimate::quote_vendor_lookup]
Set Field[Quote::quote_id; Quote::quote_id=Estimate::estimate_id]
It seems to be ignoring the values that are in those fields and setting them to 1 in the quote table. Possible bug here??
I am afraid you have two false assumptions here:
1. The formula:
returns either true (1) if the two sides of the equation are the same or false (0) otherwise. If you want to set Field X to value y, use:
Set Field [ Field X ; y ]
Set Field [ Field X ; Field X = y ]
2. When you create a new quote record, it has no related records in another table until the matchfield is given some value (as you are trying to do). Therefore the expression:
has no meaning at the time you are trying to use it - see what mr_vodka said earlier.
I had not see the variables option before, but it worked like a charm. Thanks for the info! Gave you kudos and a solution credit.