Help

Re: autofill a name according to a specific user.id

768 0
cancel
Showing results for 
Search instead for 
Did you mean: 
silaswrn
5 - Automation Enthusiast
5 - Automation Enthusiast

Hello.

I created an app which sends a user.id to airtable to identify each user. However as of no it is not possible to send the username as well as the user.id.

Is there a possibility to update a record with the correct name that matches the user.id? Which automation can I use?

Thx 🙂

2 Replies 2

Hi,

is there a table, where each username matches id ?

how do you update record, by script or automation?

in scripting, you can use Map data type, which store data in pairs 'key' : 'value'

 

let myTable=new Map([
    ['1','a'],
    ['2','b'],
    ['3','c']    ]);

myTable.set('4','d');
let myName=myTable.get('2'); // myName is 'b'

 

 

or this example, closer to real working code part

 

 

const table = base.getTable('ANY_TABLE');
const query = await table.selectRecordsAsync({fields:["Name","ID"]});
const userMap=new Map(query.records.map(r=>[r.getCellValue('ID'),r.getCellValue('Name')]))
let someId='012345'
output.text(`The name of user ${someId} is ${userMap.get(someId)} `)
output.table(Array.from(userMap))

 

silaswrn
5 - Automation Enthusiast
5 - Automation Enthusiast

Hello. 
Thank you for  your response. However I already managed to accomplish the task via automations and look up fields. Cheers 🙂