User_metadata update

Hello Community,

I found documentation about updating user_metadata. But there is only use case when you update the new value. Is there any other way to update existing value in user_metadata than update whole object?

Best

Hi @snacker00 ,

I understand that you want to update the existing value/attribute in user_metadata. Regardless of updating the value of the existing attribute or inserting a new attribute with a new value, we need to update the whole object. Unfortunately, this is the only way to update the “user_metadata”.

For example, if your user_metadata looks like the below:

"user_metadata": 
{
"attributeA": "valueA"
}

If you want to insert a new attribute attributeBwithout deleting the existing attribute, the scripts look like below:

"user_metadata":
{
"attributeA": "valueA",
"attributeB": "valueB"
}

If you want to update the existing attribute attributeB without changing the other attribute, the scripts like the below:

"user_metadata":
{
"attributeA": "valueA",
"attributeB": "valueB updated"
}

Hope this hopes! Please let me know if any further queries about this topic. Thanks!

3 Likes

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