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!
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Would you please post the following images to provide context of your updates:
Thanks!
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, Monday was pretty busy. Here is a pic
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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.
Ah, so the custom field was required for this one as the rule succeeded.
Does this solve what you needed?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It does all the things but it does not actually set the affected service.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am the site admin, lol. I will open a ticket. Thanks for all your help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yep and not it works! Thank you sir, I owe you a beer.
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.