Get User ID from field - Block


I have a field where I have a list of collaborator. I’m developping a block and I would like to get all the users ID from my field of my table.

Currently I can get the name of the collaborator with :

const base = useBase();
cont table = base.getTableByNameIfExists(“name_of_the_table”);
const value_user = my_record[0].getCellValueAsString(“Name_of_collaborator_field”);

I got the name of all my users in the value_user
But now, I would like to get the list of user ID. How can I got it ? Thank you :wink:.


Hi @Viken_Toramanian - you can just use my_record[0].id to use the unique user id within Airtable. Here’s my script to log them all out (for all records):

let table = base.getTable('Table');
let query = await table.selectRecordsAsync();

for (let record of query.records){
    let collaborators = record.getCellValue('Collaborators');
    if (collaborators) {
        for (let collaborator of collaborators) {

If this answers your question please consider marking this as the "solution". If not, please post again for more help. Thanks!
1 Like

Hi @JonathanBowen,

It works perfectly ! Thank you :+1:

I just adapt it and use selectRecords() instead of selectRecordsAsync(), because I have a function which is checking if my user is part of field “collaborator”. If I use selectRecordsAsync() the function will not check on time the condition and it will not considere if the user is part or not part of the field “collaborator”.

Thank you again for your help.

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