Change status based on component choose

I need to change the status issue if component = " NEW URL" i'm using the code bellow and it don't work 

import com.atlassian.jira.workflow.WorkflowTransitionUtil
import com.atlassian.jira.workflow.WorkflowTransitionUtilImpl
import com.atlassian.jira.util.JiraUtils

 def currentComponents = issue.getComponents()
def workflowTransitionUtil = ( WorkflowTransitionUtil ) JiraUtils.loadComponent( WorkflowTransitionUtilImpl.class )

for (c in currentComponents) {
 if (c.getName() == "NEW URL") {
 else {

1 answer

0 votes

What errors do you get in the logs?  What does "it doesn't work" mean in detail?

i don't have errot just it not work

"it does not work" is mostly useless as a problem report.

Imagine ringing a car mechanic and saying "I can't use my car".  He needs to know roughly what is wrong with it so he can bring the right tools.  "It does not work" could be a lost key, out of fuel, surrounded by a horde of angry penguins, in a ditch etc.

If your code is running and failing, there will be errors in the logs.  But your "it does not work" does not tell us where it is supposed to be running, what triggers it, or what goes into the logs.

We can't help you unless you tell us what errors you get and what "it does not work" really means.

This is the Log 

Time (on server): Mon Jun 12 2017 11:38:04 GMT+0100 (Afr. centrale Ouest) The following log information was produced by this execution. Use statements"...") to record logging information. 2017-06-12 12:38:04,240 ERROR [workflow.ScriptWorkflowFunction]: ************************************************************************************* 2017-06-12 12:38:04,240 ERROR [workflow.ScriptWorkflowFunction]: Script function failed on issue: null, actionId: 1, file: <inline script> java.lang.IllegalArgumentException: No workflow action with id '191' available for issue null at com.atlassian.jira.workflow.WorkflowTransitionUtilImpl.retrieveActionDescriptor( at com.atlassian.jira.workflow.WorkflowTransitionUtilImpl.retrieveActionDescriptorWithPermissionCheck( at com.atlassian.jira.workflow.WorkflowTransitionUtilImpl.getActionDescriptor( at com.atlassian.jira.workflow.WorkflowTransitionUtilImpl.getFieldScreenRenderer( at com.atlassian.jira.workflow.WorkflowTransitionUtilImpl.validateFieldsParams( at com.atlassian.jira.workflow.WorkflowTransitionUtilImpl.access$500( at com.atlassian.jira.workflow.WorkflowTransitionUtilImpl$2.get( at com.atlassian.jira.workflow.WorkflowTransitionUtilImpl$2.get( at com.atlassian.jira.workflow.WorkflowTransitionUtilImpl.impersonateUser( at com.atlassian.jira.workflow.WorkflowTransitionUtilImpl.validate( at com.atlassian.jira.workflow.WorkflowTransitionUtil$validate$ Source) at

This error you said you didn't have is very clear: "issue: null". This means what it says.  Your script has no issue to work with.

Makes me think your script is being run in the wrong place.

So what can I do ?!

Run the script in the right place, where it has an issue context?

It's not clear what you are trying to do, or how, or where you're running this script.  You'll need to explain that if you need more help.

I need To select the next status based on the component choose Exemple : 

If Componenet == option 1

   status == " Open "


Status  == " IN PROGRESS 

do u inderstand me now ?

I understand that, it's what your code tries to do, but you need to tell us where you want to do this.

thank you for ur help but that's my question is where should I put the code 

Have you seen, that i didn't get the code to work in the create transition, but that i found a different way to achieve your goal? I answered to your question you asked here on the same topic.
Its perhaps better to ask only once to avoid duplicates in answers.

The location depends on when you want this to happen.

Do you need it as part of the workflow?  If it's for a specific transition (e.g. move from open to in-progress), then you need to do it in a post-function

If you need to run it every time a field is changed, you need to do it in a listener.

I need it on create issue ..

Ok, that's a post-function then, but because it's a change of status, it won't work.

You need to use an automatic transition, as the create issue process needs to finish before you start the next transition.

It looks like you are using "Script Runner", which does have a "fast track transition".  Rather than try to write your own (which is, at best, "painful"), you really need to use that to do it.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,164 views 5 10
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you