Hello,
At the moment we are using the Components field in the JSM portal for users to select the application/s for which they are raising the ticket.
In the near future we want to replace the Components field with a Assets custom field named Affected Service - this field has been already created and added to the screens, and the ObjectType Applications & Products also is created in Assets, each object containing different attributes. The Affected Service field can accept multiple Objects.
Each Component in the JSM project has its corresponding Object, for example, Jira Component has Asset Object with attribute Application Name = Jira
As we have many separate automations triggered by the Components field, we do not want to replace it straight away, but instead temporary we want to have both fields in the screens - Components to get user app selection from the portal, and additionally the Affected Service Asset field to provide additional info on the selected apps.
To have that, I need an automation that will work in this way:
- On issue created, for each selected Component in the JSM issue, check if in the Applications & Products there is an Object where the Application Name equals to the selected Component, and add that same Application Object to the Affected Service Asset field
I have created one automation, but it works only when a single Component is selected.
When there are multiple Components selected, an error is thrown:
I am suspecting on two things: either I have not set properly the Components iteration, OR I need to use some Array reference when populating the Affected Service Asset field with multiple values. However, I am a bit stuck for some time.
Can anyone give some guidance or directions here - either how to fix this, or maybe suggest some alternative approach?
Thanks in advance.
Best,
Klime
Thanks guys, I totally forgot on this post.
I managed to find a solution with help from Atlassian Support:
It looked a bit strange to me, but it works as desired.
Hope it will do the same for someone else too :)
Best,
Klime
Hi @Klime Buneski
not sure if the answer is still needed, but maybe it will be helpfull for someone else.
I managed to solve quite similar concern thanks to this articles:
https://community.atlassian.com/t5/Jira-Service-Management/How-to-add-multiple-quot-affected-services-quot-via-automation/qaq-p/2036542
https://community.atlassian.com/t5/Jira-Service-Management/Dynamically-assign-value-to-Affected-Services-field-via-JSM/qaq-p/1728392
I used below approach and it worked perfectly fine form me:
If you Service Objects field (which is a custom Insights object field type) accepts multiple values, you might as well wanna use Jira's loop-over-list template stanzas:
{
"fields": {
"Affected services":[{{#issue.Service Objects}}{"id":"{{Service ID}}"}{{^last}},{{/}} {{/}}]
}
}
What it does is looping over a list of values and creating JSON structure {"id":"Service ID"} for each value inside list.
Basicaly, multiple objects Asset field stores an array of elements
[
{object_1},
{object_2},
{object_3}
]
thus it's not possible to update such field by trying to push multiple objects as one "entry"
[
{object_1, object_2, object_3}
]
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.
What is the config of the Assets CF looks like.
I think it might that the option multiple is not enabled in the Asset CF field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Marc - Devoteam , thanks for responding.
Below is the field configuration, the option is enabled and manually I can add multiple objects.
I cannot do that via the automation.
Best,
Klime
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.