sullyman Posted February 22, 2008 Posted February 22, 2008 Hi, Would anyone know of a step-by-step guide for novices to create a script that when one record is created in one table that the record is also created in another table please. I know i can allow creation of records but i need to run a script in my situation. Thanks
Inky Phil Posted February 22, 2008 Posted February 22, 2008 Hi Sully First things first allow creation of records doesn't automatically create related records. It just allows you to create new related records by adding data to the blank line at the bottom of a portal. To create a related record via a script do the following 1/Create the new record 2/store the new records keyfield data for that record into a variable or global field. 3/ Freeze the screen 4/Go to a layout that is set up to show records from the related table 5/ Create a new record there 6/Set the key field in the new related record to the variable or global field that you have used in step 2 7/go back to your original layout Job done! HTH Phil
David Jondreau Posted February 22, 2008 Posted February 22, 2008 Would anyone know of a step-by-step guide for novices to create a script that when one record is created in one table that the record is also created in another table please. As stated, this request is suspect. Why do you want to create duplicate records?
LaRetta Posted February 23, 2008 Posted February 23, 2008 (edited) ... allow creation of records doesn't automatically create related records. It just allows you to create new related records by adding data to the blank line at the bottom of a portal. Not to quibble but 'Allow Creation' does more than that. It allows you to create related records simply by setting a field in the related table ... no portal necessary at all and no going to the related table. And if you set any field (other than the matching key), it will automatically insert the key for you. It is quite powerful and I know you understand this, Phil, but I wanted others to see the great value of 'Allow Creation' as well. For instance, in Sully's situation, he may (when he runs the new record creation script), simply set a related field at the same time thus creating his 'child.' But automatically creating a related record (unless you are going to use it) does go against good practice. Without more information, we are again attempting to pin a tail on a blind rabbit. Update: Sully, if you are scripting, you can create ONE child based upon the match key between them as I've said - just by setting a field. But if you want more than one child, you need to pull in other criteria which would make the second child record unique from the first. Otherwise, you would just overwrite the first record. But I will quit guessing what you need. Edited February 23, 2008 by Guest
Wickerman Posted February 23, 2009 Posted February 23, 2009 Not to quibble but 'Allow Creation' does more than that. It allows you to create related records simply by setting a field in the related table ... no portal necessary at all and no going to the related table. And if you set any field (other than the matching key), it will automatically insert the key for you. It is quite powerful and I know you understand this, Phil, but I wanted others to see the great value of 'Allow Creation' as well. LaRetta (or anyone?), I know this is an old thread, but I hope I can still engage the topic. I'm trying to get comfortable with this technique but am not quite clear on it. I have a simple parent-child relationship with Record Creation on and would simply like to be able to "tag" parent records (say, 'Movie Titles') with multiple child records that indicate 'Genre' (a Movie can participate in multiple genres). So, (A) one way is to have a simple portal and let the user enter genre terms in the last open slot -- but this is poor because it's too easy to create blank records, alter existing records, etc. It's messy. Another ( is to create a global field where the user selects a genre term from a picklist and then executes a script that goes to the related table (needs to be a layout, yes?), creates a record, inserts the matching key field and genre term, commits the record, and returns to the original context where the term an now be displayed in a portal list. -- but this is needlessly complex, and may cause flashing on slow systems, switching layouts, etc? So, in the simple method you describe, a script can merely use a "Set Field" command, grabbing the global value as in method (: and setting that value in the Genre field in the child table? I just tried this, and what happens is that, if there is no child record, one is created okay -- but if I try to add a second one, it merely changes the value in the first child record -- there's no record creation going on. How can I force the script to create a series of child records? Thanks for help on this hugely useful technique. Albert PS -- I seem to recall another thread on this I read once, but now I can't find it!
Recommended Posts
This topic is 5753 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