Update status depending on field value via JMWE

Anette Noll
Contributor
June 11, 2024

Hi all,

would be great if someone could put me on the right track with regard to the following scenario:

  1. New issue is created
    Create screen contains custom field with value 1, 2 or 3
    Conditions:
    if custom field contains 1, than status is set to status A after clicking create
    if custom field contains 2, than status is set to status B after cklicking create
    if custom field contains 3, than status is set to status C after cklicking create

  2. Every time the issue is updated it looks which value (1, 2 or 3) shows up and sets the status accordingly.

Is there is any solution with the help of JMWE? I am very curious to learn how this works.

Thank you.

1 answer

1 accepted

2 votes
Answer accepted
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 11, 2024

Hi @Anette Noll 

Jira doesn't allow the status of an issue to be changed directly. Instead, it uses transitions defined in the workflow to move issues between statuses. 

Therefore, to achieve what you're trying to do, you need to use a Transition Issue(s) post function to automatically trigger the appropriate transition on the issue. 

So the first thing to do is ensure you have "global transitions" in your workflow that go from any status to the A, B, and C statuses. 

Then, the easiest is to create a Shared Action that contains 3 Transition Issues post function, each triggering the transition to status A, B, and C, respectively, and each with the required Conditional execution to run it only if the custom field has the appropriate value.

Then, you can:

  • add a Shared Action post-function to the Create transition of your workflow to run the shared action you just created
  • create an Event-based action that reacts to the Field Changed event, for your custom field, and in the post functions of that event-based action, add the same Shared Action post-function to run the shared action you just created

The advantage of using a Shared Action is that if you need to modify the configuration (say, add a 4th custom field value and destination status), you will make changes in a single place only (the share action).

Anette Noll
Contributor
June 11, 2024

Hi @David Fischer 

Thank you so much for response and your explanation.

But it seems that I make a mistake while following your points.

In the moment I create a new issue the following happens:

 

  • Custom field contains value 2, status B is expected after creation
  • What happens is that the newly created issue changes successively through all statuses (A, B and C) automatically
  • Concerning the event based action I wonder how I integrate it in the workflow

 

Jira_S.PNG

 

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 11, 2024

Hi @Anette Noll 

from what I can see (your screenshot is not very legible), you didn't provide a "conditional execution" script but instead a comment text. You need to add what you put as comment text in the Conditional Execution option.

Anette Noll
Contributor
June 12, 2024

Hi @David Fischer ,

thanks again for response.

It works almost completely, but I am still facing two problems:

  • All postfunctions in the shared action show errors.
    I guess that this is because of this:
    if field value changes and issue has been refreshed, status plays kind of ping pong until finally the correct status is displayed. Any solution to this?

    Jira Errors.png
  • only one post function does not produce the expected Jira status.
    Expected status is Approved - issue refresh and the following happens:
    approved - in progress - approved - it stops and stays with "in progress"

    I cannot find any significant difference between postfunction that produces correct status (green frame) and postfunction that produces incorrect status (red frame). What am I overlooking?

    Jira Errors Gegenüberstellung.png

 

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 13, 2024

Hi @Anette Noll 

Regarding the errors, you'd need to expand one of them to see the actual error details and share that here.

Regarding the status changing on the screen, it's a limitation of Jira Cloud, it updates the status "lazily".

As for the transition that fails, you need to check if it has a transition screen and a validator that prevents the transition from happening. You can try to manually trigger the Approve transition and you'll see if there's any requirement during that transition.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events