Database Reference
In-Depth Information
You can't add an invoice record from the Jobs layout, so you're switching to a layout
attached to the Invoices table first.
3. Add the New Record/Request step after the second comment step .
Keep it consistent: “Real” steps go after the comments.
4. Add the Set Field step to the script. The target field is the Invoices::Job ID field
in the list, and the calculated result is Get(ScriptParameter) .
You're putting the Job ID in the new Invoice's Job ID field, which will relate it to the
proper job. Of course this means you have to pass the Job ID to the script when you
run it from the parent script.
5. Add a Set Variable script step after the Set Field . Name the variable $in-
voiceID and then set its value to Invoices::Invoice ID .
You're grabbing the new invoice's ID now, while you're still on the Invoice layout, so
you can put it in the line item records later.
6. Add the Go to Layout step to the script and if necessary, choose “original lay-
out” from the Specify pop-up menu .
Subscripts should always return the database to its previous state, so the main script
doesn't get lost in the wrong context.
7. Add an Exit Script step at the end of your script. Its result is $invoiceID . Save
and then close the subscript .
Your script will look like Figure 17-27 . Since you set the new invoice's ID in a local
variable, you'll pass it back to the main script with a script result.
Search WWH ::




Custom Search