Database Reference
In-Depth Information
The script will return to the expense record it started the loop on.
15.
Add a
Set Field
step. The target is
Expenses::Line Item ID
, and the calculated
result is
$linteItemID
.
The value in
$lineItemID
links the expense record to the Line Item record the script
just created.
16.
Add a
Go to Record/Request/Page
step. Specify Next in the pop-up menu and
then select the “Exit after last” option
.
This step makes sure you're working through the found set and can get out of the loop
after the script has worked on the last record.
17.
Add a
Go to Layout
step at the end of your script. Set it to go to “original lay-
out.” Edit your TODO comments, move them into place and then save the script
.
Don't get so caught up in the complexity of a script that you forget to make helpful
comments.
Compare your script with
Figure 17-30
. Now you can hook up the last Perform Script step in
the “Create Invoice for Job” script (don't forget the
$invoiceID
script parameter). Then add
a
Go to Layout [“Invoices” (Invoices)]
step at the end to show the new invoice.
Make sure you show the new invoice by adding a Find Record step that uses the
$InvoiceID
variable to search the Invoices::Invoice ID field. Finally, all five scripts are done! You're
ready to test the script.