I am trying to define an automation rule based on Smart Values that sets the priority of an issue based on finding in the issue description the value of a severity. The issue is originated via mail from a different ticketing system.
The logic would be something like:
- If summary contains "Severity" and after Severity I find:
By default, tickets are P3.
I have tried different approaches, none of them seem to work:
- Branching, which seems to work, but after branching setting the priority I need to clone the ticket into another project and carry over the priority, and in some cases it hasn't been updated in time, which clones the ticket with incorrect priority
- IF/THEN actions, which could work but would force me to copy all actions in the 4 different branches, which does not sound right to me
- Smart values like this work in an EDIT field action:
{
"fields": {
"priority": {
"name": {{#if(issue.description.substringAfter("Severity").substring(1,50).match(".*(Critical).*").isNotEmpty())}}"P1"{{/}}
}
}
}
However, I can't use them to set different cases as per my logic, and If I try to duplicate the edit action as per my conditions, it retrieves the error invalid JSON, I suppose because it does not accept different values for the same field even when there is an #if
Any recommended approach for this?
First thing: I recommend using a select list field for your values rather than the Description to drive setting the Priority. It is more manageable, controllable for entry, and reduces errors.
If that is not possible, I recommend using the last approach with conditional logic, with some adjustments. The reason you got the invalid JSON is that you are not handling all possible cases.
I recommend...
You could do all of this in a single condition, with nested ifs, although that will be more difficult to debug and maintain over time.
Kind regards,
Bill
Hello @Raul Blazquez
As per my understanding, IF/ELSE construct is the best way.
For this, you can extract the substring, store it in a variable and use it to build the If/ELSE construct.
Please let me know if you ned help with the rule.
--GG
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.