Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Condition Descriptor Scriptrunner

Mohamed Darmoul May 28, 2024

Hello Community , 

Can you help me please in determining how to get the Workflow Transition condition  details with Scriptrunner ? 

I used this method :

// Get the conditions
def conditions = workflow.allActions.collect { action ->
def transitionName = action.name
def conditionDescriptor = action.getRestriction()?.getConditionsDescriptor()
def conditionName = conditionDescriptor?.conditions.each {ConditionDescriptor condition ->

def conditionName = condition.getArgus()
}

 

but it does not work , I get the following error : No signature of method: Script543$_run_closure1$_closure4$_closure7.doCall() is applicable for argument types: (com.opensymphony.workflow.loader.ConditionsDescriptor) values: [com.opensymphony.workflow.loader.ConditionsDescriptor@4c312dce] Possible solutions: doCall(com.opensymphony.workflow.loader.ConditionDescriptor), findAll(), findAll(), isCase(java.lang.Object), isCase(java.lang.Object)

Anyone can help please . 

Thank you in advance . 

 

2 answers

1 vote
Ram Kumar Aravindakshan _Adaptavist_
Community Champion
May 29, 2024

Hi @Mohamed Darmoul

Could you please provide a little bit more information, i.e. why are you trying this approach and what information are you trying to obtain?

I am looking forward to your clarification.

Thank you and Kind regards,
Ram 

Mohamed Darmoul May 29, 2024

Hi @Ram Kumar Aravindakshan _Adaptavist_ 

Thank you for feedback . 

Actually I would like to retrieve the conditions Names inside the transition Conditions section in a workflow

Example : 

2024-05-29_11h46_28.png

Best ,

Mohamed

0 votes
Mohamed Darmoul May 30, 2024

Hello , 

Is there anyone who can help me out ? 

Thanks you in advance .

 

Ryan Simoens
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 5, 2024

Mohamed,

The following works for me to get the various details of the conditions defined for a specific transition. I was just dumping the "rval" back to the scriptrunner console for confirmation.

...
JiraWorkflow
jiraWorkflow = workflows.getWorkflow(true, "jira with Blocking");
Collection<ActionDescriptor> allActions = jiraWorkflow.getActionsByName("Close Issue");
for (ActionDescriptor action : allActions) {
    RestrictionDescriptor restrictionDescriptor = action.getRestriction();
    if (restrictionDescriptor != null)
        List<ConditionDescriptor> conditions = restrictionDescriptor.getConditionsDescriptor().getConditions();
        for (ConditionDescriptor condition : conditions) {
            rval = rval + "<br/>" + action.getName() + " (" + action.getId() + ") -> " + condition.getArgs() + "<br/>";
        }
    }
}
...

Suggest an answer

Log in or Sign up to answer