Hey @Shayda_Haddad,
To write to a single collaborator field, you need to pass in an object with the user id. You can get all of the collaborators for a base via base.activeCollaborators
. One way to make this easier to consume is to construct a mapping:
let collaboratorIdByName = {};
for (let collaborator of base.activeCollaborators) {
collaboratorIdByName[collaborator.name] = collaborator.id;
}
This object maps collaborator names to ids. You could also use collaborator.email
as the key, especially if a base has multiple collaborators with the same name. Once you have this mapping, you can do the following:
await tasks.createRecordsAsync([
{
fields: {
‘Task’: ‘Pixel Check: TM Artist/Event’,
‘Show Name’: [{id: projectId}],
’Assigned To’: {id: collaboratorIdByName[name]},
},
},
])
You can read more about the cell formats and field options here: Airtable Scripting