Transitioning Issue Automatically Depending on the Value of a Field

Issue #582 resolved
Weston Rossborough created an issue

I'm trying to execute an issue's transition after the issue is created. This depends on the value set in a select list when the issue is filled out and submitted.

I'm referencing these instructions and I was able to get it working.

However, I'm having trouble with the Post Function rule that is set to run. The field that this rule is checking against has options with parenthesis in their naming schema. This seems to conflict with the required syntax in the Post function rule. I've included screenshots of both the working and non-working rules. Is there a way to modify the syntax to include parenthesis in the option names? In this example I want the select list option called Application Implementation (ASAP) to execute the transition Auto Approved when the ticket is created.

Non Working Rule: NonWorking.jpg

Working Rule: Thanks! Working.jpg

If I remove the parenthesis from the option name the rule executes fine.

Thanks!

Comments (4)

  1. Fidel Castro Armario repo owner

    Hi Weston,

    The problem is that the conditional part of a type 1 setting rule is a regular expression. Parentheses characters have special meaning for regular expression, that's why you should escape them using a backlash (\).

    Try the following setting rule:

    (Application-Implementation \(ASAP\))Auto Approved
    
  2. Weston Rossborough reporter

    Thanks for responding so quickly! This worked.

    Do regular expressions allow for searching for a similar match vs an exact match?

    For example, if possible I would like to have one rule that searches for any options that have (ASAP) at the end of their name. There are 20+ options like this in the select list I'm referencing in the Post Function, and this would cut down on the amount of rules I would have to write.

    This logic would be similar to a boolean expression like: %{11807} ~ "(ASAP)"

  3. Fidel Castro Armario repo owner

    Yes, you can use the following regular expression: .*\(ASAP\).*

    Your setting rule would be:

    (.*\(ASAP\).*)Auto Approved
    
  4. Log in to comment