Help

Upcoming database upgrades. Airtable functionality will be reduced for ~15 minutes at 06:00 UTC on Feb. 4 / 10:00 pm PT on Feb. 3. Learn more here

Unable to update the value of a multiple select field

Topic Labels: API
290 5
cancel
Showing results for 
Search instead for 
Did you mean: 

Hello community! :upside_down_face:

I have a table where I store my products, in which I have a multiple select field called “Who has access”. I`d like to record in that field the user id of all users that had purchased each of my products.

I`m using Bravo Studio to develop my app so I have a PATCH request API there, where I enabled the “typecast” parameter, once Id like to be able to concatenate a new user id every time that request is called.

However, every time I execute the request the value of the field “Who has access” is overrided instead of concatenated with the new user id. :confounded:

My JSON code in the PATCH request looks like:
{
“records”:
[
{
“id”: “${record_mimo_id}”,
“fields”:
{
“Who has access”: [“${user.id}”]
}
}
],
“typecast”: true
}

Im struggling to find out what Im doing wrong :sob:
Does anyone can help please?

5 Replies 5

Welcome to the Airtable community!

You need to send a value that includes the old values and the new value. If you do not already have the old values, you will need to first do a read to get the existing values.

However, you might also want to use a linked [User] table instead of a multi-select field. Then when you create the new user, you can link the new user to the product, and the backlink will automatically be filled in for you.

Thank you very much Kuovonne for your replying :upside_down_face:
Actually I`ve already tried to get, through a GET request API, the current value of the field and pass that together the new id, but it didnt work too :smiling_face_with_tear:
My test was like this:

{
“records”:
[
{
“id”: “${record_mimo_id}”,
“fields”:
{
“Who has access”: [“${who_has_access}”,${user.id}"]
}
}
],
“typecast”: true
}
Your first suggestion would be something like that?
And about your second suggestion, how exactly could I do that?

And I did a test of create a new “link to another record” field on the product table, then I get the current value of that field through a GET request API and try to update that value through my PATCH request API, but when I have more then 2 users in the array it keeps overriding one of the values to record the new user id

{
“records”:
[
{
“id”: “${record_mimo_id}”,
“fields”:
{
“UserProfileTable”: [“${userprofiletable}”,“${user.id}”]
}
}
],
“typecast”: true
}

How can I do to make it understand that I dont want to record just 2 items in the array, but as many as its necessary?

This is not the correct method of combining the previous value with the new value. You are lumping all the existing values into the first part of the array, instead of spreading them out in the new array.

How familiar are you with coding and handling arrays?

I have just a little bit of knowledge about coding cause I used to be a software developer, but that was a long, long, looooooooong time ago :grinning_face_with_sweat:

Because of that I`ve choosen a no-code tool (Bravo Studio) to make my app :upside_down_face: So once they and Airtable have a very good and organized documentation and awesome communities, I was getting by, but when I have to do something more complex or specific, I struggle :smiling_face_with_tear:

Look into what array handling tools are available in your no-code tool.