Save the date! Join us on October 16 for our Product Ops launch event. Register here.
Sep 02, 2022 10:39 PM
Not sure why I’m getting this error. Using an empty array works and removes the values. Essentially what I’m doing is, I’m matching companies to different events. I want to add the companies that are matched when found in the loop into my field called “Mail_Chimp_Company_LookUp”. This script is automatically updating all records every time an event is created. The results variable is an array of companies that are matched to the event tags.
Solved! Go to Solution.
Sep 03, 2022 11:09 AM
You need an array of objects, each with their own record ID. You are putting all the IDs in a single object. Notice that the object key is id
and not ids
. That is a clue that you need to include only one ID.
Try something like this …
“Mail_Chimp_Company_Look”: [
{id: Ebay.id},
{id: Amazon.id},
{id: FaceBook.id},
],
Sep 03, 2022 05:46 AM
In order to update a linked record field you must use the internal record ID (recXXXXXXXXXXXXXX
). It looks like you are using the company name instead.
Sep 03, 2022 10:07 AM
So, for all the company names in the results array, we need to use their internal record id as input for my lookup field? If I had for example,
Results = [Ebay, Amazon, FaceBook]
Need to get internal id of these records in the table I’m linking to, correct? So, this results in an array of internal recordId for each company name?
“Mail_Chimp_Company_Look”: [{id: [Ebay.id, Amazon.id, FaceBook.id]}
I’m still getting the same error. It shouldn’t really matter what string value I pass into the look-up field, as long as it’s a string.
My query_2.records[j].id is rec1VgmTbsREkyHKP.
Sep 03, 2022 11:09 AM
You need an array of objects, each with their own record ID. You are putting all the IDs in a single object. Notice that the object key is id
and not ids
. That is a clue that you need to include only one ID.
Try something like this …
“Mail_Chimp_Company_Look”: [
{id: Ebay.id},
{id: Amazon.id},
{id: FaceBook.id},
],
Sep 03, 2022 11:45 AM
Thank you for the clarification, it worked! I appreciate it! I didn’t notice it was an array of ids. I just assumed that after each comma separated value, it would be added to it.