Update custom attribute via JavaScript Api
3 3

4 posts in this topic

Hi,

I would like to update the value of a project's custom attribute via the javascript api. Is that even possible in v.0.4.5?

Since the ContextCustomAttributeValue does not have an own id (at least none is provided when fetching the custom_attributes as a relation of a project),  I cannot find a way to specify the (entity-) key argument in the session.update('ContextCustomAttributeValue', [key], data) function.  Or can the key argument array hold multiple values to specify the exact ContextCustomAttributeValue (like entity_id of the project and the key of the custom_attribute)? I tried some things there to no avail.

Or is that just the wrong approach?

Thanks in advance,
Paul

Share this post


Link to post
Share on other sites

Hi Paul and welcome to the forums.

This is an example of how to se the ContextCustomAttributeValue, the first id in the entity_key is the custom attribute configuration id, the second one is the project id.

{"action": "update", "entity_data": {"__entity_type__": "ContextCustomAttributeValue", "value": "31"}, "entity_key": ["d25219d6-acb5-11e1-8668-f23c91df1211", "32580850-64a2-11e7-a4bd-0a580ae40187"], "entity_type": "ContextCustomAttributeValue"}

 

Share this post


Link to post
Share on other sites

Hi Mattias,

thanks, it works. Just out of curiosity: Is that procedure documented anywhere? Because I tried to look it up before posting here and could not find anything. 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
3 3