How to use script runner to modify workflow?

Tejashree Khedekar June 12, 2015
 

1 answer

1 accepted

0 votes
Answer accepted
Nic Brough -Adaptavist-
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 12, 2015

What do you mean by "modify workflow"?  

e.g.

  • Edit the workflow directly? 
  • Change the workflow scheme on a project?
  • Change a workflow scheme?
  • Control the flow a user follows within a workflow? 

Note that three of those are a potential nightmare that you probably don't want to do...

Tejashree Khedekar June 12, 2015

I need to write script to modify workflow. In the workflow, after certain steps I need to check condition, if the condition is true then perform some task etc. 

In short I need to implement algorithm in the workflow. I saw some groovy scripting. But could not understand how to implement algorithm using script to modify workflow? please help me.

Nic Brough -Adaptavist-
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 12, 2015

I do not understand the objective. Do you want to modify the workflow or actually just create a workflow that works for your process?

Tejashree Khedekar June 12, 2015

My workflow already exists. I need to modify my workflow with set of statements like a script for example: my script is 1. Once issue status changed to "construction". (condition) if service request = request for change. 2. If condition fails, then switch to next state transition. 3. else if condition true, then check next condition if subtask=java 4.if condition fails then switch to next transition 5. else perform some task.

Nic Brough -Adaptavist-
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 12, 2015

That's not modifying a workflow, that's automating a process, and it's not clear what you're trying to do, but I'll try to paraphrase it and explain what you might do. Issue status is a function of the workflow. So by "issue status changed to construction", you mean "Someone uses the transition that puts the issue into construction". Now, I think the (condition) you mention, but don't explain, means "I have a custom field called 'Service Request'. If the user has selected "Request for change" in that custom field, I don't want to leave the issue in 'construction', I want it to have some other status I'm not clear on your if/then/elses either, but they're not that important, because we're only looking at the basic idea of what you need to do. To do the second transition, you need the system to detect that case, decide which transition it needs to use, and then push the issue through it. The Script Runner does have an auto-transition function - see https://jamieechlin.atlassian.net/wiki/display/GRV/Built-In+Scripts#Built-InScripts-Fast-tracktransitionanissue but it might not be quite what you need.

Tejashree Khedekar June 14, 2015

See I will explain you., what you understand is correct. I have a custom field called service request and sub-task. If someone puts the issue in "construction", then workflow should follow some steps: 1. if (service request=request for change) is true, then go to step 3. 2. if (service request = request for change) is false, then go to step 7. 3. if (sub-task=cobol) is true, then go to step 5. 4. if (sub-task=cobol) is false, then go to step 7. 5. write some data to a attachment file. 6. save and close the attachment. 7.Now put the issue in "AAHO" phase.

Nic Brough -Adaptavist-
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 15, 2015

Ahh, good. Then yes, you can use the script-runner's auto transition facilities to do this.

Tejashree Khedekar June 15, 2015

Can you explain in detail how to implement it with my example? because as there are two conditions needs to be checked. step 1 and step 3.

Suggest an answer

Log in or Sign up to answer