Hi,
We are using JIRA cloud. We have some fields that not supposed to be edited by users which are not part of a specific group. To achieve this, we used JIRA Automation that detects when ever the field is edited & edited by user not in specified group, update the field value with {{fieldChange.fromString}}.
The Step-By-Step detail is given below:
Trigger: When value changes for "Custom Field"
Condition: Initiator is not in group "User Group"
Action: Edit Fields "Custom Field" with {{fieldChange.fromString}}
The above automation is working fine for text fields. But when it comes to Multi Select fields, the Jira smart value {{fieldChange.fromString}} is returning a string which is not valid for Multiselect custom field.
Eg: if the multi select custom field has values A, B, C selected, the smart value {{fieldChange.fromString}} is returning A,B,C as a string. If I try to load it to the custom field, the field is getting cleared as the format is not supported.
Can anyone help me solving this issue please.
Thanks & Regards,
Ganesh Kumar Vary
I was presented with the same problem as @Ganesh Kumar Vary
Following up on @Bill Sheboy's response, here's the solution I found -- in your automation rule, add the following components in this order:
{{fieldChange.from.replaceAll("\\[", "").replaceAll("\\]", "").replaceAll("\\s*,\\s*", ",").replaceAll("([^,]+)", "{\"id\":\"$1\"}")}}
{
"fields": {
"customfield_XXXXX": [{{previousValue}}]
}
}
This should successfully revert your custom multiselect field back to the previously selected value(s). Depending on the value options you have in your field, you may have to adjust 2.2.1 above to account for text variances. Here's are screenshots of the rule in case it's helpful (irrelevant components are blurred out):
Rather than using {{fieldChange.fromString}} you could use {{fieldChange.from}} to get the prior, selected id values, and then parse them to use advanced edit with JSON to set them back.
https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#--fieldChange--
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.
Do you have Scriptrunner? If so, then you could create a Behavior that would make the field read-only unless the user was in a particular group.
Otherwise, it appears that the rule would need to know what type of field it needs to set the value.
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.