Multiple linked records in script

Topic Labels: Automations
314 1
Showing results for 
Search instead for 
Did you mean: 
4 - Data Explorer
4 - Data Explorer


I'm trying to create a script that copies a record in another table, and there is a record linked to another table (agents). If i try the script when the record has 1 agent it works, but it crashes if it's more then one agent. 

This is the problematic part of the code. How can i fix this?


let recordID = await task.createRecordAsync({
'Detail' : inputConfig.detail,
'Agent' : [{id:inputConfig.agent.toString()}],
1 Reply 1

Is inputConfig.agent outputting an ID string?

Try replacing 'Agent' : [{id:inputConfig.agent.toString()}], with

'Agent' : => ({id: a})),