Hello!
Please help me with the Jira Automation. I need to change a multi-user field so that role removes inactive users from it. Otherwise, it is a pain in the Data Center when there are inactive users in the field, then another rule cannot change the values of this field until inactive users are removed.
I have some test rule. And i going to be change it so removing only inactive users. How i can use IF? It will be something like that:
IF({{#issue.customfield_10053.name.active}} == false, remove ... {{/}})
As a result, the multi-user field will contain only active users.
Additonal fields text:
{ "update": { "customfield_10053" : [ {{#issue.customfield_10053.name}}{"remove": {"name":"{{.}}"}}{{^last}},{{/}}{{/}} ] } }
Are you trying to remove the inactive users from:
The first one could be done by filtering on active equaling true, and replacing the selections using a JSON expression. That could be this:
{{#issue.customfield_10053}}{{#if(active)}}{{name}},{{/}}{{/}}
Test with a condition that the variable is not empty, and then set the values with JSON, or clear the field if not of the users were active.
{{#if(exists(varActiveUsers))}}
{
"fields" : {
"customfield_10053": [
{{#varActiveUsers.substringBeforeLast(",").split(",")}}
{ "name": "{{.}}" } {{^last}},{{/}}
{{/}}
]
}
}
{{/}}
As you started in your rule, you could invert this to use not(active) for the removals with an "update", and that will require testing if there are no values to remove.
The second one (i.e., removing from the list of possible values) would require calling the REST API to change the available options / users in the field configuration.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.