Update the collaborator field

Hi

I’m playing around with scripting (not a programmer) and I’ve run into a situation where I can’t update assign the collaborator object.

I’ve modified my code to represent what I’m looking for

Collaborator is the collaborator field on my base. I’m trying to assign a collaborator (through a previous function) named ‘assignCollaborator’

await table.updateRecordAsync(record, {
         "Collaborator": {
             "name": assignCollaborator}
     })

The errors I’m getting say that the fields don’t exist but I can create references like this

let collabName = record.getCellValue("Collaborator").name

Some explanation here would be super helpful.

Thank you

Per the scripting API documentation, there are multiple properties that can be read from collaborator fields, but when writing to such fields, the only property allowed is the ID of the collaborator.

1 Like

Thanks, Justin

To be clear if I can obtain the ID of a collaborator that ID is then global to our orgs airtable correct?

I’d like to think so, but I can’t confirm that because I’ve not needed to write any scripts that deal with collaborator fields, and unfortunately I’m not in a position to run any tests until tomorrow at the earliest.

@Devon_Stanton Sorry for the delay on this. I just ran a quick test, albeit a limited one because I can only safely test using myself as a collaborator. That aside, the test showed that my user ID is the same across all bases and workspaces that I can access. While I can’t confirm with complete certainty, I’d like to think that this behavior would carry across to other bases where a given user has been invited to collaborate, assuming that the collaborator ID is somehow connected to the user’s own Airtable account and not generated dynamically when they’re invited to collaborate.

Unfortunately I cannot test any further, but you could probably run your own tests more reliably anyway.

1 Like

Dude you went above and beyond, and you really didn’t need to. I did some tests and got it working as you suggested. Thank you for all your help I really appreciate it!

1 Like

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.