Mar 16, 2020 04:25 PM
Mar 16, 2020 04:43 PM
That was good… excellent idea, @openside!
Jul 22, 2020 05:20 PM
@openside thanks so much for the code! Do you have any suggestions on how to tweak the code so that the fields (Source and Destination) are fixed, and we don’t need to select them upon running the script?
Jul 22, 2020 07:28 PM
Read the top of the script code. It gives instructions on how to update the configuration section (labeled in the code) so you don’t have to answer those prompts each time.
Aug 21, 2020 10:40 AM
Thank you @openside! This Script has been so integral to our workflow that we have now automated the process!
Below is the process laid out:
The Automation triggers your script with a few modifications to eliminate calls to “Output”.
Works beautifully! :grinning_face_with_big_eyes:
Sep 09, 2020 01:41 PM
@openside do you know of any way to do this automatically when a forward link is created, rather than having it be run manually on a large batch?
Sep 09, 2020 05:33 PM
now with automations you could set it up to listen for changes to the initial link field and then run a modified version of this script that just processes that single record.
Sep 10, 2020 09:53 AM
I just tried that and it works, but has a major limitation: in the automations you can’t receive the value of the changed field, if the changed field is a linked record field. This means that you don’t know what changed, which means (I think) that you have to do a full walk of the table, basically running your whole script every time a change is made. I tried this on ~180 records and it took seconds to run. I’m very nervous about what will happen when we get to thousands of records.
Am I wrong about the automation not receiving the value of the changed field, or about the implication of that?
Thanks!
Theo
Sep 10, 2020 11:01 AM
Correct.
Not necessarily. Because you have the record ID of the triggering record, that can be passed to the script via an input variable. Run a query on the table, then use the getRecord
method on that query to select the specific record that triggered the automation (using that input variable). That will let you read any of its fields, including the link field, which will return an array of objects for the linked records. Iterate through that array and add links back to the triggering record. No searching needed.
Sep 10, 2020 01:59 PM
But what if the change removed a record link rather than adding one? Without doing a full walk to find them, how do you avoid orphaned back-links?