March 17, 201114 yr Hi. I need help with a script line that will insert a variable into a field. Here's the premise: I have two related tables: contact info and project info. From the contact info layout, I had a script that copied the clientNumber and then created a new record in the project table and pasted the clientNumber into the new record thus automatically linking the project to the client. The copy/paste method fails of course because of clipboard issues. Now I'm trying use a variable to handle this task. What I want is for the script to set variable X to the clientNumber then when the new record is created, insert the value associated with the variable. I've been experimenting with the Set Field and Insert functions but have had not luck. Is this the right approach, is there a better way to handle this type of thing? Thanks in advance for your help
March 17, 201114 yr You're almost there. Check out the New Invoice button on the Quote form in the attached demo. It shows how to capture a key and populate the foreign key, using a $var. QuoteInvoice.fp7.zip
March 17, 201114 yr Try something like: Set Variable [ $clientNo ; Contacts::ClientNumber ] Go to Layout [ Projects ] New Record Set Field [ Projects::ClientNumber ; $clientNo ] ... I presume you'd want to set more fields at this point, rather then creating an empty related project. Another option is to pass the ClientNumber as script parameter, then: Go to Layout [ Projects ] New Record Set Field [ Projects::ClientNumber ; Get (ScriptParameter) ] ...
Create an account or sign in to comment