Via an automation rule I have a field called Application. This is a custom Insight field.
For each selected value in this application field I need to set an Affected services (= default field with services from OpsGenie)
Unfortunately the affected services field does only support the set operation and not add meaning all values have to be provided at once.
This works:
{
"update": {
"Affected services" :
[{"set":
[{"id":"{{lookupObjects.first.Service.Service ID}}"}]
}]
}
}
This doesn't:
{
"update": {
"Affected services" :
[{"add":
[{"id":"{{lookupObjects.first.Service.Service ID}}"}]
}]
}
}
Does anyone have creative ideas to solve this?
Snippet of my rule:
Hi Charlie,
I had the same issue, please look at the next page. Loop-over list option in a combination with advanced branching worked for me.
Goodluck
Marius
Hi Marius,
Thanks for replying on this question. In the meantime I already found a solution but it is very similar to the post you linked.
I am looping over my list of values in the "edit issue task":
{
"update": {
"Affected services" :
[{"set":[
{{#lookupObjects}}
{"id":"{{Service.Service ID}}"}
{{^last}}, {{/}}
{{/}}
]
}]
}
}
I'll mark your answer as accepted to close this :-)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I used the same solution above, but only one "Servico" is added to Affected services. It seems that the command is overriding the other items. Any thoughts?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In my case, I have three different services to be added. The logs show that the branch rules work for the three services perfectly, but only one of them is added to the list (that was previously empty - before the automation).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you try changing your second JSON snippet so the value of "add" is an object? At the moment, the value of "add" is an array.
I'm just trying to follow the example outlined in https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/.
Eric
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Eric,
Thanks for your suggestion.
I actually got an error along the lines of: add operation is not supported.
I also double checked using the /editmeta endpoint and here is the result:
https://<xxx>.atlassian.net/rest/api/3/issue/TSD-530/editmeta
"customfield_10036": {
"required": false,
"schema": {
"type": "array",
"items": "service-entity-field",
"custom": "com.atlassian.jira.plugins.service-entity:service-entity-field-cftype",
"customId": 10036
},
"name": "Affected services",
"key": "customfield_10036",
"autoCompleteUrl": "https://<xxx>.atlassian.net/rest/service-registry-api/service?query=",
"operations": [
"set"
]
}
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.