Hi,
I have an attribute on an object that can store multiple references to other objects. In this case a 'Business Application' object that has a field for 'Technical Owners' that can hold multiple references to an 'End User' object.
I am trying to use the 'Edit Object' action in a 'For AQL' branch to append a new Object to the values already stored in 'Technical Owners' but haven't had any success. The automation will always log "Objects successfully updated" but nothing happens.
"Assets attributes can have many different types of values (string, integer, user, date, reference object, etc.), so you have to get the input right here. This rule will result in an error if the value in this action doesn't match the attribute type. Learn more about Assets in Jira Service Management."
Hello @David Foote
Jira doesn't currently support editing mutli-value Asset Object attributes in the Edit Object automation action. There is a change request about that here:
https://jira.atlassian.com/browse/JSDCLOUD-11392
To accomplish your goal through Automation you would need to use the Send Web Request action and interact with the API for editing objects. I see you already have figured out the API call. Have you already added that to your rule with a Send Web Request action?
I did find a post with an alternate suggestion about using the Edit Object Attribute action instead.
I have not tested this myself.
It references an article that talks about setting multi-value attributes, but the article does not specifically mention setting Object type attributes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That article had the solution! https://support.atlassian.com/jira/kb/how-to-append-objects-to-an-assets-object-attribute-using-automation/
Essentially, because it is expecting a list, we can't just pass a string and get it to work. But by using the .split function on a string, we can get it in a list format and then multiple values will be set.
For future reference, here is what I set the userObject variable to:
"CMDB-33551","CMDB-33839"
And then in the Edit Object action I used the following smart value in the Technical Owners field and the object updated successfully to have two values:
{{userObjects.split(",")}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @David Foote , thanks for your post.
Please can you share some screens of the automation rule and the objects (anonymised is fine)?
You are trying with an action to add more Technical Owners to the object. Have you tried using JSON for this? https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/
We had a sort of similar use case once where we needed to update which instance an object needed to be sync-ed with, but, sometimes the object needed to be sync-ed to both. So, rather than use the edit field and update to the new value, we needed to be able to add an additional value to what was already there.
If you can share some more information, we will try to help you get this working.
Cheers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Valerie Knapp - unfortunately the 'Edit Object' action does not let me use JSON like the 'Edit Issue' action - which I would really love to be able to do!
Here is the Object configuration, I've highlighted the attribute
Here is the cardinality of that field; I don't have any issues putting multiple objects in there via the UI
Here is the automation where I just simple AQL branch on one object, log the value of the 'Technical Owners' field and then try to update it; I'm just hardcoded all values right now to try and get it work.
And finally, here is the audit log where it shows there is only one value in Technical Owners (the first log section) and then runs the Edit Object. It says it runs successfully but going to object shows that nothing changes
I have Key in ("CMDB-33551", "CMDB-33839")
in the Edit Object value right now, but I've tried many different formats with no success yet.
Edit: I have noticed that it will update based on Key in ("CMDB-33551", "CMDB-33839") - but it sets it to the last value in the list - it will not add multiple objects.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here are all the iterations of hardcoded values I've tried to set multiple values without luck:
CMDB-33551, CMDB-33839
"CMDB-33551", "CMDB-33839"
["CMDB-33551","CMDB-33839"]
"CMDB-33551" || "CMDB-33839"
CMDB-33551 || CMDB-33839
["CMDB-33551" || "CMDB-33839"]
Key in ("CMDB-33551", "CMDB-33839")
Key in ("CMDB-33551"), Key in ("CMDB-33839")
Key in ("CMDB-33551") || Key in ("CMDB-33839")
[{"objectKey": "CMDB-33551"}, {"objectKey": "CMDB-33839"} ]
{"objectKey": ["CMDB-33551","CMDB-33839"]}
{"key": ["CMDB-33551","CMDB-33839"]}
{"objectAttributeValues": [{"objectKey": "CMDB-33551"}, {"objectKey": "CMDB-33839"}] }
[{"value": "CMDB-33551"}, {"value": "CMDB-33839"} ]
[{"value": "CMDB-33551"}, {"value": "CMDB-33839"}]
{"objectTypeId": 96,"attributes":[{"objectTypeAttributeId": 2969,"objectAttributeValues":[{"value":"CMDB-33551"},{"value": "CMDB-33839"}]}]}
{"value": ["CMDB-33551", "CMDB-33839"]}
"attributes":[{"objectTypeAttributeId": 2969,"objectAttributeValues":[{"value":"CMDB-33551"},{"value": "CMDB-33839"}]}]}
{"objectAttributeValues":[{"value":"CMDB-33551"},{"value": "CMDB-33839"}]}
"objectAttributeValues":[{"value":"CMDB-33551"},{"value": "CMDB-33839"}]
[{"value":"CMDB-33551"},{"value": "CMDB-33839"}]
{"value":"CMDB-33551"},{"value": "CMDB-33839"}
{"CMDB-33551","CMDB-33839"}
I have been able to set multiple values via the API using the PUT /object/{id} endpoint and passing the following body:
{
"objectTypeId": 96,
"attributes": [
{
"objectTypeAttributeId": 2969,
"objectAttributeValues": [
{
"value": "CMDB-33551"
},
{
"value": "CMDB-33839"
}
]
}
]
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here are the hardcoded values I've tried in 'Edit Object' without success
CMDB-33551, CMDB-33839
"CMDB-33551", "CMDB-33839"
["CMDB-33551","CMDB-33839"]
"CMDB-33551" || "CMDB-33839"
CMDB-33551 || CMDB-33839
["CMDB-33551" || "CMDB-33839"]
Key in ("CMDB-33551", "CMDB-33839")
Key in ("CMDB-33551"), Key in ("CMDB-33839")
Key in ("CMDB-33551") || Key in ("CMDB-33839")
[{"objectKey": "CMDB-33551"}, {"objectKey": "CMDB-33839"} ]
{"objectKey": ["CMDB-33551","CMDB-33839"]}
{"key": ["CMDB-33551","CMDB-33839"]}
{"objectAttributeValues": [{"objectKey": "CMDB-33551"}, {"objectKey": "CMDB-33839"}] }
[{"value": "CMDB-33551"}, {"value": "CMDB-33839"} ]
[{"value": "CMDB-33551"}, {"value": "CMDB-33839"}]
{"objectTypeId": 96,"attributes":[{"objectTypeAttributeId": 2969,"objectAttributeValues":[{"value":"CMDB-33551"},{"value": "CMDB-33839"}]}]}
{"value": ["CMDB-33551", "CMDB-33839"]}
"attributes":[{"objectTypeAttributeId": 2969,"objectAttributeValues":[{"value":"CMDB-33551"},{"value": "CMDB-33839"}]}]}
{"objectAttributeValues":[{"value":"CMDB-33551"},{"value": "CMDB-33839"}]}
"objectAttributeValues":[{"value":"CMDB-33551"},{"value": "CMDB-33839"}]
[{"value":"CMDB-33551"},{"value": "CMDB-33839"}]
{"value":"CMDB-33551"},{"value": "CMDB-33839"}
{"CMDB-33551","CMDB-33839"}
I was able to use the API to successfully set multiple values using the PUT /object/{id} endpoint with the following body
{
"objectTypeId": 96,
"attributes": [
{
"objectTypeAttributeId": 2969,
"objectAttributeValues": [
{
"value": "CMDB-33551"
},
{
"value": "CMDB-33839"
}
]
}
]
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.