Feb 06, 2024 02:26 AM - edited Feb 06, 2024 02:55 AM
Hi @dashler78 experts,
I have an interface which has a dropdown and a button. When a user chooses a value from the dropdown and clicks on the button, an automation script runs doing the following
1. It saves the value chosen in the dropdown.
2. Updates 'Created By' as 'Automations'.
I want the script to even update another field say 'User' with the user object (of the person who actually clicked the button).
Is there a way to input the actual user object using automation script?
I saw that I am able to get 'email id' , 'id' - which is usrXXXXXXXXXX and name. However what I actually want in the field is the complete user object which is similar to how 'Created By' and 'Modified By' fields look. Kindly let me know how this can be made possible?
I am using an automation script because that is the only way I can save the value from a dropdown in an interface.
Currently when I try adding the id in the User (field is of type: User) field, it gives me the following error
Error: Field "fldyaWWxTRvpc9bSc" cannot accept the provided value.
at main on line 18
thus indicating that I am trying to enter a string where an object is expected. I saw the airtable documentation but haven't found any document on how to insert an actual object into a field. Any suggestions are more than welcome.
Alternatively would I need to change string to object using the id? Is there a way to do this?
Solved! Go to Solution.
Feb 06, 2024 04:36 AM
Could you provide the relevant bit of the script you're using so that I can help troubleshoot?
If it helps, this works for me for a 'User' field that allows adding multiple users:
await table.createRecordAsync({
'Assignee': [{id: collaborator.id}]
})
And this works for me for a 'User' field that only allows one user
await table.createRecordAsync({
'Assignee': {id: collaborator.id}
})
Feb 06, 2024 04:36 AM
Could you provide the relevant bit of the script you're using so that I can help troubleshoot?
If it helps, this works for me for a 'User' field that allows adding multiple users:
await table.createRecordAsync({
'Assignee': [{id: collaborator.id}]
})
And this works for me for a 'User' field that only allows one user
await table.createRecordAsync({
'Assignee': {id: collaborator.id}
})
Feb 06, 2024 05:11 AM
Hi,
Thank you for your response. I found out why I was getting it wrong. I was trying the multi user format for the field that accepted only 1 user and hence was getting the error. But now with the second syntax, you have shared above, I am able to get the desired result. Thank you once again!