Transitioning Issue Automatically Depending on the Value of a Field

Issue #575 resolved
Scott McDonald created an issue

Hello -

I am trying to add similar functionality. I have a checkbox field (Review Required) with 2 values (yes, no). I want to automatically transition the issue to Review if that field has a value of 'Yes' selected, however when I add logic similar to the logic above, I still have to click a button rather than it automatically transitioning at the step in the workflow I need it to.

Field to be checked: Review Required Target field to be set: Issue status (delayed writing)

Yes (In Review) No (Close)

Thank you,

Scott

Comments (27)

  1. Fidel Castro Armario repo owner

    Hi Scott,

    Since "Set a field as a function of other fields" is a post-function, it can only be executed within a transition.

    You can use the following workaround:

    1) Remove field Review Required form EDIT screen. It can remain in VIEW and CREATE screens.

    2) Create a new screen called "Screen for editing 'Review Required'", and add it field "Review Required".

    3) Create a global reflexive transition called "Edit 'Review Required'". This transition will be available from all the statuses of your workflow, and will not change current status, since it has same status as origin and destination. This kind of transitions are created like shown in the following screenshot: global-reflexive-transition.png

    4) Add screen "Screen for editing 'Review Required'" to transition "Edit 'Review Required'".

    5) Add "Set a field as a function of other fields" post-function to transition "Edit 'Review Required'" with the same configuration you are currently using.

    Now, you will have to execute transition "Edit 'Review Required'" in order to set of update field "Review Required".

  2. Scott McDonald reporter

    I'm not entirely sure of the expected outcome but I'm not getting the issue to transition automatically. I've added the transition Edit 'Review Required but now a button is appearing (is that correct?). Once I select that button, the edit screen appears and I select the value of 'Yes' and update. From there, I transition the issue through the workflow but it's not automatically placing the ticket "In Review". An "In Review" appears and I can select it then the issue transitions to close but nothing is automatic. I'm attaching screenshots for your reference.

    Workflow Screen Shot 2017-04-12 at 9.50.58 AM.png

    'In Review' transition (am I'm adding this functionality to the wrong transition? I want the process to basically automatically move from in process to (in) review if the value of Yes is selected in the Review Required field. Screen Shot 2017-04-12 at 9.56.14 AM.png

  3. Fidel Castro Armario repo owner

    Hi @scottjmcdonald,

    The values expected by "Issue status (delayed writing)" are status names. According to your screenshots, the status names are Closed and Review, but you are writing Close and In Review. Try using the following setting rules in your post-function:

    (Yes)Review
    (No)Closed
    

    On the other hand, it's required that there is a transition from current status to the status you want to move the issue to. If there isn't any transition in some of the statuses, you can add a global transition to status Review (global transitions allow to move to a certain status from all the statuses of the workflow). You can hide this global transition to interactive users by adding condition "Transition is triggered by JIRA Workflow Toolbox post-function" to the global transition.

  4. Scott McDonald reporter

    I must be completely missing the boat on this one.

    • There is now a 'Edit Review Required' button on the screen but should there be?
    • The post function has been added at the In Review Transition ** The field Issue status (delayed writing) will be set according to the evaluation of Review Required? against the following set of rules: (Yes)Review (No)Closed This feature will be run as user in field Current user
    • I've also added the Condition "Transition is triggered by JIRA Workflow Toolbox post-function" at the same Transition (In Review)

    I still can't get it to auto move nor can I get the In Review button to even appear. I know I want to auto move it but I can't even get the button to appear.

    Any thoughts to what logic I'm missing and where?

    Thank you,

    Scott

  5. Fidel Castro Armario repo owner

    Hi Scott,

    Yes, you should see the button for executing transition "Edit Review Required". That's the only way you will have for editing field "Review Required".

    The post-function should be added to "Edit Review Required" transition, not to In Review. Look at step 5 in my description of the solution. You should fix that.

    Remove condition "Transition is triggered by JIRA Workflow Toolbox post-function" from "In Review" transition. That the cause you are not seeing the button anymore.

    I told you to add the condition to a global transition to Review status, in case you needed to add that transition in order to make possible to transition to Review status from other statuses where currently there isn't any transition to Review status. For the moment, don't create that transition, and let's see whether the solution works without it.

  6. Scott McDonald reporter

    Beautiful! Once I added that post-function to the Edit Review Required transition, the ticket automatically moved.

  7. Scott McDonald reporter

    Hello -

    Trying this in another workflow and I can't get the ticket to automatically transition.

    Use Case: I'm attempting to automatically move the ticket from Validate to Pending based on a certain value in the field but I can't get it to transition.
    Functionality: Created global transition and added screen. I've added 'Set a field as a function of other fields' to the global transition.
    Outcome: when i execute the Validate transition and set the field (any direct reports) value to either yes or no, the ticket doesn't auto transition to pending.

    Screen Shot 2017-07-14 at 9.11.26 AM.png
    Screen Shot 2017-07-14 at 9.11.04 AM.png Screen Shot 2017-07-14 at 9.10.36 AM.png Screen Shot 2017-07-14 at 9.03.21 AM.png

    Thank you!

  8. Fidel Castro Armario repo owner

    Hi @scottjmcdonald,

    Please, double check that options in field "Any Direct Reports?" are correctly written in the setting rules, respecting the case.

    If that's not the cause of the problem, try adding a third setting rule (.*)Pending. Let me know if you get the issue transitioned after adding that rule.

  9. Scott McDonald reporter

    Hello.

    I've added that setting rule to the post function of the global transition but it still doesn't work. Screen Shot 2017-07-14 at 10.42.38 AM.png

    Also, does the global transition button need to appear on the screen or can that be hidden?

    Thank you,

    Scott

  10. Fidel Castro Armario repo owner

    Hi @scottjmcdonald,

    Field Any Direct Reports? should be edited through a screen associated with global reflexive transition, i.e., you should execute the transition, then a screen with field "Any Direct Reports?" will be shown. You set the field and then post-function "Set a field as a function of other fields" will be executed.

    But there is something strange. You want to transition to Pending in any case (i.e., Yes and No). Is that correct?

  11. Scott McDonald reporter

    Hello -

    Yes, I have the Any Direct Reports? field appearing on a screen both on the global reflexive transition and Validate transition screens. I will select a value of either Yes or No, click Validate but it doesn't automatically transition to the Pending status. Are there are any other screenshots I can send you?

  12. Fidel Castro Armario repo owner

    @scottjmcdonald,

    I think that in this scenario you don't need the global reflexive transition.

    Do the following:

    1. Associate screen with field Any Direct Reports? to transition Validate.
    2. Add "Set a field as a function of other fields" post-function (with the 2 setting rules only) to transition Validate.
  13. Scott McDonald reporter

    I've added the screen to the transition Validate as well as added the post-function (see image) to Validate, however, it still doesn't automatically to transition.

    Screen Shot 2017-07-14 at 3.40.46 PM.png Screen Shot 2017-07-14 at 3.39.38 PM.png

  14. Fidel Castro Armario repo owner

    Setting rules should be:

    (Yes)Pending
    (No)Pending
    

    If it doesn't solve the problem. Please, attach a XML export of the workflow.

  15. Fidel Castro Armario repo owner

    Hi @scottjmcdonald,

    I don't see any problem in your workflow. It should work.

    Transition to status Pending is carried out with some delay, thus the browser will not show the new status immediately. You need to refresh the browser after executing transition "Validate Setup" in order to see the actual status of the issue.

    Please, let me know if this is the problem you are experiencing.

  16. Scott McDonald reporter

    That's not working either. Just to be clear, when I select the Validate Setup transition button and answer the any direct reports question and click validate, I want the ticket to transition to Pending automatically. That is not happening.

  17. Fidel Castro Armario repo owner

    Hi @scottjmcdonald,

    I don't understand why it's not working. I'm using your same configuration with success.

    Let's simplify the workflow as much as possible in order to force auto-execution to skip "Validation" status:

    Do the following changes in the workflow:

    1) Remove post-function "Set a field as a function of other fields" from transition "Validate Setup". If you prefer it, you can also simply disable the post-function by inserting the following boolean expression in parameter Conditional execution:

    false
    

    2) Add "Copy a parsed text to a field" post-function to transition "Validate Setup" with the following configuration:

    • Target field: Issue status (delayed writing)
    • Parsing mode: basic
    • Text to be parsed: Pending

    Add this post-function at first position in execution order in transition "Validate Setup".

    Now, execute post-function "Validate Setup", and then refresh your browser. Issue must be in Pending status.

    If it keeps not working, use the following text in parameter Text be parsed...: Pending : {delay=2000}

    After executing transition Validate Setup wait for 2 seconds and then refresh your browser. The issue should be in Pending status.

  18. Scott McDonald reporter

    That automatically transitioned the issue! Thank you! However, one bit of concern. I don't think the user experience will be the best and it may cause confusion having to assume it moved or refreshing the browser...plus, when I click on the Pending Setup transition, I receive the following message: Screen Shot 2017-07-17 at 11.52.05 AM.png

    Is there any way to make the user experience better?

    Thank you,

    Scott

  19. Fidel Castro Armario repo owner

    *HI @scottjmcdonald,

    Sorry, but there is not current solution for that.

    Anyway, If you always need to skip Validate status, why don't you create a transition from Open to Pending. This way, you will solve the problem with the user experience.

    BTW, in the Create Issue transition you have the same post-function 3 o 4 times. I don't find a reason for that. Why don't you leave only one?

  20. Scott McDonald reporter

    And to your point regarding skip validate status, do you mean have my workflow only be Open, Pending and Close?

  21. Fidel Castro Armario repo owner

    Hi @scottjmcdonald,

    Post-functions 3rd, 4th, 5th and 6th in Create Issue transition of your workflow are exactly the same. I don't find a reason for that. You can leave only one.

    In relation to status Validate, I consider that it's not necessary in your workflow, since your issues always bypass it.

  22. Log in to comment