Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,296,838
Community Members
 
Community Events
165
Community Groups

How to add multiple "affected services" via automation

Charlie Misonne Community Leader May 24, 2022

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: 

2022-05-24 09_10_51-Automation - Jira.png

2 answers

1 accepted

1 vote
Answer accepted

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

Charlie Misonne Community Leader Jun 10, 2022

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 :-)

0 votes
Eric Atlassian Team May 26, 2022

Hi @Charlie Misonne 

 

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

Charlie Misonne Community Leader May 27, 2022

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"

    ]

}

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS
Community showcase
Posted in Jira Service Management

Jira Service Management Documentation Opportunities

Hello everyone, Hope everyone is safe! A few months ago we posted an article sharing all the new articles and documentation that we, the AMER Jira Service Management team created. As mentioned ...

330 views 0 10
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you