Skip to main content
Solved

How to create a new record and populate a link field (assuming you have record ID)

  • February 19, 2023
  • 1 reply
  • 19 views

Forum|alt.badge.img+12

I am creating a new record triggered by a script with the following code:

 
let newRecs = {};
newRecs[0]['id'] = 'recDYGIT7fj80tTAH';

await table.createRecordAsync({
'Start Date/Time': billTillDate,
'Contact': newRecs,
'Notes': 'New Record note'
});

I am getting the following error:
 

 

TypeError: Cannot set properties of undefined (setting 'id')
 
Can you please modify the script - assuming the record Id is correct - so I can populate my Contact link field?
 
Thank you!

Best answer by Kosta_Kondraten

Never mind fixed it with the following code:

await table.createRecordAsync({
'Start Date/Time': billTillDate,
'Contact': [{id: 'recDYGIT7fj80tTAH'}],
'Notes': 'Working!'
});
 
Closing issue now 

1 reply

Forum|alt.badge.img+12
  • Author
  • Inspiring
  • 46 replies
  • Answer
  • February 19, 2023

Never mind fixed it with the following code:

await table.createRecordAsync({
'Start Date/Time': billTillDate,
'Contact': [{id: 'recDYGIT7fj80tTAH'}],
'Notes': 'Working!'
});
 
Closing issue now