May 21, 2024 03:26 PM
May 21, 2024 07:00 PM
Hi,
please describe what do you want to do with the record.
May 22, 2024 06:19 AM
In short I have two tables, and what I essentially need this script to do is to look into a multi-select field named "Client" and pull all the values, and then I need it to look into a single select field named "Group Name" and pull its value. Then I need the script to look into the other table and identify the record that has a match with the client name in the field "Name". If it finds a record with a matching name, then I need the script to find the checkbox field where the name of the field matches the string in the first table's "Group Name" field, and then set that field's value within that specific record to True. I need this to do this for however many client names there may be in the multi select field "Client".
May 22, 2024 07:23 AM
If anyone is interested, I was able to solve this particular problem using the following formula:
May 22, 2024 10:00 AM
@matt66hew12 wrote:If anyone is interested, I was able to solve this particular problem using the following formula:
Thank you for sharing your solution. You state that you have almost zero background in JS, so it might be helpful to other people who are also new to JS to see an example of what it takes to get a working script. For example, how was your original script created? (It looks like AI might have been involved in its creation.) Your revised script (that you call a formula) looks very different from the script in your screen shot. Did you adjust the original script until it worked, or did you start from scratch? Did you get help from AI at any point in the process? If so, what types of prompts and which AI were the most useful? Did you get help from a human in the process?
Also note that if your script finds many matching records to update, you might run into automation runtime limits because you are updating records one at a time instead of in batches.
May 22, 2024 10:08 AM
@kuovonne I just had to walk AI out of the logic loop it was in by going line by line on the errors. How would I adjust the code to update in batches rather than individually?
May 23, 2024 09:55 AM
Thank you for explaining how you used AI to revise the script.
This example script in the documentation shows one way of updating records in batches. Instead of using updateRecordAsync() inside the loop, you create an array of updates inside the loop, and use updateRecordsAsync() after the loop.