Dec 28, 2022 04:41 AM
Hello,
I'm learning to run scripts and have been able to successfully write a couple of scripts for my work as a coach.
I already know how to ask for the number of sessions (eg. ¿how many sessions?: 3) and then automatically create 4 records that are as follows: KickOff, Coaching1, Coaching2 and Coaching3.
My difficulty is in how can I automatically create dependencies with linked records to the same table. So for example: Coaching1 has KickOff as predecesor, Coaching2 has Coaching1 as predecesor, Coaching3 has Coaching2 as predecesor.
Attached you can see a simplified table...
The script I have up to now is:
Dec 28, 2022 09:53 AM
Congrats on your progress in your coding journey!
Because you want to populate a linked record field with a record that you are also creating, you will need to create the records one at a time. When you create a new record, you get the record ID of the record just created. You then use that record ID to populate the linked record field of the next record you are creating. The format for a linked record field is in the scripting reference.
Dec 28, 2022 10:38 AM
Hello Kuovonne,
Thanks for your help... I'm really new to scripting so please be patient with my basic questions :).... I think the link of 'create a new record' is something I'm already ok with, if you see my script I'm even creating multiple records with a 'for' function.
Now I looked into the 2nd link you sent me... and I see that I need to have the RecordID and inserted in the 'recXXXXXX' part of the script. But because I'm creating the records in the same script, and I have multiple records being created I wouldn't be able to put a fixe RedordID by typing it...
I wonder how can I maybe walk in this way:
1. Create the record.
2. Capture the RecordID of 1st created record
3. Insert that RecordID on my 2nd record PredecesorField.
Again... thanks for your help.