lesley1160 Posted November 4, 2004 Posted November 4, 2004 Please could someone tell me how to create a script which will automatically create a related record in a separate file? I have two files, Parts and Purchase Order. I would like to create a script which will allow me to create a Purchase Order record after a Parts record is created. At the moment I am having to fill in the details in Parts and then have to go to Purchase Order, insert Customer ID, select "Machine" from a value list, the information (order no., part no. etc.)appears in a portal. Is there a way to do this part automatically? Many thanks.
RalphL Posted November 4, 2004 Posted November 4, 2004 You need 2 scripts, 1 in each file. You will also need global fields to hold info to be passed from one file to the other via a constant relarionship. The script in the related file creates the new record and set fields to values from the global fields in the other file. The script in the first file set the values of the global fields and then calls the script in the related file.
-Queue- Posted November 4, 2004 Posted November 4, 2004 If you have 'Allow creation of related records' selected in your relationship, then you can Set Field [relationship::nonkeyfield, data] and the relationship will be auto-established via new record creation and nonkeyfield will be populated. You can then Exit Record/Request and proceed to set the remaining fields via relationship. Only one script is necessary for this technique and you don't have to do anything to the related file. See here for more info.
lesley1160 Posted November 6, 2004 Author Posted November 6, 2004 Many thanks Ralph and Queue for your help, I've managed to get it to work. Lesley
Recommended Posts
This topic is 7325 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 accountSign in
Already have an account? Sign in here.
Sign In Now