Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Question about jira automation script

ADM Amar Msaid April 25, 2023

i write a script that is triggered when the issue is created. i want to transitionne the issue to status that is not the first status in the workflow (see inserted image). The first status in the workflow (after the beginning) is ATT_VERIF_CGRH but i want to transitionne the ticket to the ATT_VERIF_PARH status when a certain condition is verified. 

i get this message in the log and the ticket id tarnsitionned to ATT_VERIF_CGRH

error message.PNG

this is my workflow:

Workflow.PNG

is it possible to have a second transition from the begining (1) to ATT_VERIF_PARH status (3)  and resolve this error ?

Thank you.

 

1 answer

1 accepted

0 votes
Answer accepted
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 25, 2023

Hello @ADM Amar Msaid 

Can you please show us the entire automation rule? Often problems are caused by the context in which the step executes. We can't know the context without seeing the rule.

Regarding your diagram, location 1 is not actually a status. It is just a visual indicator of the starting point in the status workflow.

Location 1 can have a transition to one and only one status. When the issue is initially created it will be set to the indicated status (2).

You can use your automation to then transition it to the next status (3), but you can't bypass status (2) based on how your workflow is constructed. 

ADM Amar Msaid April 26, 2023

Hi Trudy,

yes, my need is to use automation script to transit directly to status (3) when a condition is meet regarding data collected in the ticket. but it seems that we can't do this in a script triggered when the ticket is created.

i have the same error message when i use action to transit to status (2) even if the transition occure because status (2) is the next status after the begining of the workflow.

it is very easy to reproduce the case. just create a workflow with two statuses and write a script that runs when the ticket is created and that makes a transition to one or the other of the two statuses. you will get an error message and the ticket is still transitioned to the first status.

here the complete rule and error message

 

rule1.PNG

rule2.PNG

rule3.PNG

 

error2.PNG

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 26, 2023

When an issue is initially created it is set to the first status in the workflow. The rule is executing after the issue creation is completed and the issues is already set to that first status.

You are getting the error that the issue can't transition to ATT_VERIF_CGRH because the issue is already in that status, and there is no transition to go from that status to that status.

You don't need to try to transition the issue to the first status as part of the rule. That is taken care of during the issue creation process. In your rule you only need to transition it to the next status - ATT_VERIF_PARH

Like ADM Amar Msaid likes this
ADM Amar Msaid April 27, 2023

Hi,

My conclusion is that it seems to be impossible to transition a ticket to a status other than the first status of the workflow in a rule that is triggered when a ticket is created.

In my case, I cannot transition to ATT_VERIF_PARH status. That's why there is the second error message.

In a script that runs when a ticket is created, there is no need to use a transition action because the status after creation will be always determined by the workflow (the status linked with the beginning point of the workflow).

do you agree with me?

thank you.

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 27, 2023

I don't fully agree with you.

The initial status for a newly created issue is determined by the workflow for that issue. The issue will be set to that status as part of the issue creation process.

A rule that uses an "Issue Created" trigger is triggered after the creation process is completed for that issue. By the time the rule is triggered and executes the issue already exists and the initial status has been set.

If you can manually transition an issue from that initial status (ATT_VERIF_CGRH) to the new status (ATT_VERIF_PARH) through the UI, then it will be possible to make that same transition happen through an automation rule, if that is what you want to do.

If you want to have a rule that will transition an issue from (ATT_VERIF_CGRH) to (ATT_VERIF_PARH) I would suggest that you start by creating a very simple rule to confirm it is possible to make that change:

TRIGGER: Issue Created
CONDITION: Status equals ATT_VERIF_CGRH
CONDITION: <your issue type condition>
ACTION: Transition Issue to ATT_VERIF_PARH

If that fails to work share the rule Audit Log with us and we can debug the failure.

There is a lot going on in the original rule you have, making it challenging to debug why the transition may not be occurring. Things to check would include:

1. Review the workflow for that issue type and confirm that a transition exists between the To and From statuses.

2. Check if there are any Conditions or Validators on that transition that might not be getting met when the Automation Rule runs.

3. Check the Actor set for the rule and confirm that Actor has the permissions necessary in that project to transition that issue.

ADM Amar Msaid April 28, 2023

Thank you very much,

i agree with you. i found my mistake. there is a condition that prevented the transition to occurs.

To resolve this, i added permission to project role atlassian-addons-project-access to exécute the transition from the automation script.

Like Trudy Claspill likes this

Suggest an answer

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

Atlassian Community Events