Text comparison is failing in Condition evaluation

Issue #775 resolved
Marc Fukuda created an issue

Using the "Boolean condition with math, date-time or text-string terms" as a Condition To Transition, I am comparing "Only if the following boolean expression is true: %{Previous issue status} != %{Target status}".

However, even when this true, the workflow button does not show up. But when I use the same function "Boolean condition with math, date-time or text-string terms" as a Validator To Transition to do the same comparison, it works fine.

Comments (6)

  1. Fidel Castro Armario repo owner

    Hi @mfukuda,

    Virtual field "Target status" behaves differently depending on whether it's used on Conditions, or in Validators and Post-functions.

    • In Validators and Post-functions the value returned is the target status of the transition.
    • In Conditions is a comma separated list with all the achievable statuses using a single transition from issue current status.

    Example: the value of Target field for transition "Start Progress" in the default JIRA workflow is:

    • Validators and Post-functions: In Progress
    • Conditions: In Progress, Resolved, Closed

    This explanation is in Virtual Fields.

    The following boolean expression checks whether previous status is not among the achievable statuses from current status:

    %{00138} not in %{00177}
    

    where %{00138} is field code for Previous status, and %{00177} is field code for Target status.

    Is that boolean expression ok for your needs?

  2. Marc Fukuda reporter

    Fidel,

    No, it does not work for me. I meant to have an equal check %{00138} = %{00177}. Meaning I need to confirm the specific status they are trying to move to, not just if that is an acceptable status to move to.

    I am using this to implement returning to last status functionality. Any status can move to Onhold. I then have a transition back to each of the 20 status, but I need to show only one transition that matches the last status they were in.

    Thanks for the wiki link. I was not expected that same field to behave differently based on where it was used. That usage on Conditions seems like it should be different parameter like "Available Statuses" or something.

  3. Fidel Castro Armario repo owner

    Hi @mfukuda,

    Yes, you are right. I'm considering changing the behavior for conditions, and create a virtual field "Achievable statuses". The problem here is that it can break back compatibility for some users.

  4. Fidel Castro Armario repo owner

    Hi @mfukuda,

    Try version 2.2.42_beta_5. In this version:

    1. Field Target status has the same behavior in conditions, validations and post-functions.
    2. Field Achievable statuses has been added, which returns a comma separated list with all the statuses achievable from current issue status.
  5. Log in to comment