Hello,
I've approvers field that I want to populate with data from multiple attributes in the linked asset.
I'm able to get the array from one attribute and set it into approvers.
However when I want to append another array I fail to succeed.
I'm able to append a single user using the update option using this documentation example:
{ "update":
{
"customfield_12345": [{
"add": { "value": "{{issue.customfield_12224}}" }
}]
}
}
However using the array it returns success but not appending values:
{ "update" :
{ "customfield_12345" : [ {
"add" : {{MyAssetField.AssetAtribute.flatten.asJsonObjectArray("id")}}
} ]
}
}
For a question like this, context is important for the community to help. Please post the following:
Until we see those...
In the examples you show, you appear to be adding two completely different values to customfield_12345: a single field value and an asset attribute.
First, have you tested the contents of your asset attribute contain what you expect?
Next, you are attempting to use the function asJsonObjectArray() incorrectly in two ways: with the wrong attribute of "id" versus "value", and trying to add an array within an array.
Finally, if your source information is indeed from an asset value, those are looked up just-in-time, and so there could be timing problems when the value is not provided fast enough to be used in the dynamic JSON expression.
Let's assume your asset data {{MyAssetField.AssetAttribute.flatten}} produces a comma-separated values list. To solve the timing problem, that could be stored with Create Variable. That variable could then be split() into a list, and iterated to create the dynamic JSON expression in the Edit Issue action (recently renamed to Edit Work Item action).
{
"update": {
"customfield_12345": [
{{#varAssetData.split(",")}}
{ "add": { "value": "{{.}}" } } {{^last}},{{/}}
{{/}}
]
}
}
Kind regards,
Bill
Hi @Bill Sheboy thank you for replying.
I'm doing the same strategy for "fields" option and it works.
So proving more context.
I'm able to do the first copy as I'm using "fields" option under "additional fields" with following code:
I'm doing re-fetch to give some time to the first edition be processed.
However when I'm trying to update to append the 2nd attribute users and I fail to succeed.
I'm trying this code, that is the exact strategy as for Fields option:
The array (id) give function gives me the id format that we need as we can see in the log.
The log says the issue was successfully edited, but data is not appended.
BTW tested your code and returns error:
Error while parsing additional fields - Mismatched start/end tags: null != in template-9b3fxxxxxxxxxxxx
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for the additional information.
When using the "add" operation for the field, there can only be one value in the JSON, not a list of values. That is why the iteration technique I noted is required to include an "add" expression for each one.
If instead you want to "set" the value to replace all of the values in the field, use the "fields" syntax as that is the same as using "update" with "set".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Understood. Actually I want to append information.
I used fields to set the info from 1st attribute. and want to append information from 2nd attribute.
I tried your suggestion but returned:
Error while parsing additional fields - Mismatched start/end tags: null != in template-9b3fxxxxxxxxxxxx
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.
Sorry for the delay in responding; with the community site updates, some of the notifications were not working well.
Please post images of:
Thanks!
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.
Oops...typo as the pound sign # is missing from my earlier post. Please use this:
{
"update": {
"customfield_10003": [
{{#varSystemOwners.split(",")}}
{
"add": {
"value": "{{.}}"
}
} {{^last}},{{/}}
{{/}}
]
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Journeys is a brand new feature in Jira Service Management that helps you streamline various processes in your organization that may cross multiple departments, such as employee onboarding or off-boarding that require action from different teams. ✨
Join the EAP →Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.