Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 5000 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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

Posted

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

Posted

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) ]

...

This topic is 5000 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.