Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Automation question on setting an affected service

Mikel Whipple
Contributor
June 20, 2025

I am writing an automation to look at the team field when an issue is created and set the affected service of the same name. In my testing the affected service is not being set but I am not receiving an error either. I am not great at json so I am wondering if my script needs adjusting and perhaps what might not be set correctly. Thank you! 

Team automation.png

1 answer

1 accepted

1 vote
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 20, 2025

Hi @Mikel Whipple 

I see a few things to check in the rule images you show...

First, the Edit Issue (or Create Issue) action may only update a field one way in a single action: with the field dropdown list or with JSON.  You have selected both.  Please remove the field from the dropdown list, update your rule, and re-test.

Next, have you confirmed your value exactly matches one of the defined values for Affected Services?

Finally, if the smart value does not work, perhaps try the custom field ID for Affected Services in the JSON.  You will need to look that up from an example work item, perhaps using this how-to article: https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

Kind regards,
Bill

Mikel Whipple
Contributor
June 20, 2025

Thanks. I am looking into this. 

Mikel Whipple
Contributor
June 22, 2025

The article you posted was a ton of help, when I tested other variations of the JSON I still cannot find one to work. From the article it says to know the type of field you are wanting to change, although Jira does not list what type of field affected services is from my determination I am going with multi-select. Then from there I could either use update and set or field. Trying field I get a success but it does not set the affected service in testing, I have determined the Team and Affected Service are the same name. Then I used the update and set operation, knowing that I want to clear anything in that field and then set it. This gives me an error that affected service is not an array. I am still back to square one. Thanks for the help though, I might have to open a support case. 

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 22, 2025

Would you please post the following images to provide context of your updates:

  • the complete rule in a single image
  • the edit issue / work item action
  • the audit log details showing the rule execution, expanding the areas at the right side to show the details

Thanks!

Mikel Whipple
Contributor
June 24, 2025

Sorry for the delay, Monday was pretty busy. Here is a pic

 

teams automation  pic.jpgteams automation  pic 2.jpg

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 24, 2025

Let's try these...

Add another Log action before the Edit Issue action, pasting in the entire JSON expression, and then run your rule.  After it runs, post what you see for the log.  This will help indicate why the rule does not accept that JSON.

 

Next, please use an example issue (e.g., TSD-33) with this how-to article to find the custom field ID for "Affected services": https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

For some fields, rules require the JSON to use the custom field ID rather than the smart value for the field name.

Mikel Whipple
Contributor
June 24, 2025

I have updated them and ran the test. 

 

teams automation  pic 4.jpgteams automation  pic 3.jpg

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 24, 2025

Ah, so the custom field was required for this one as the rule succeeded.

Does this solve what you needed?

Mikel Whipple
Contributor
June 24, 2025

It does all the things but it does not actually set the affected service. 

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 24, 2025

It appears there is no public REST API endpoint to update the values, and so rules cannot do so.  Perhaps JSM does it with internal endpoints.

Curiously, using the get issue endpoint does return the ID for a selected Affected Service...but not the name.  And when I check the edit metadata, it does show it can be set.

 

I recommend working with your Site Admin to submit a ticket to the Atlassian Support team to ask them: https://support.atlassian.com/contact/#/

When you hear back from them, please post what you learn to benefit the community.

Mikel Whipple
Contributor
June 24, 2025

I am the site admin, lol. I will open a ticket. Thanks for all your help! 

Like Bill Sheboy likes this
Mikel Whipple
Contributor
July 9, 2025

Update. After working with support came to find out that the affected service field is tied to asset so I built an asset object lookup and then had it set the affected service based on the asset object it found. Still it is finding everything it needs but it is still not setting the service. Now in opsgenie we did this using the API, I might have to switch to use the Jira Ops API to set the service. teams automation  pic 5.jpg

 

 

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 9, 2025

Thanks for the update, and...there appears to be a missing curly bracket at the end of the JSON you show.  Is it indeed missing, or is it just outside the view due to extra line breaks?

Like Mikel Whipple likes this
Mikel Whipple
Contributor
July 9, 2025

yep and not it works! Thank you sir, I owe you a beer. 

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
ENTERPRISE
TAGS
AUG Leaders

Atlassian Community Events