Skip to main content

autofill a name according to a specific user.id

  • March 1, 2023
  • 2 replies
  • 39 views

Forum|alt.badge.img+2

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

Alexey_Gusev
Forum|alt.badge.img+25

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))

 


Forum|alt.badge.img+2
  • Author
  • New Participant
  • March 10, 2023

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