Forums

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

How to change issue type and workflow in groovy?

wiisoftware-corp May 8, 2020

Hello wonderful people!

Can someone help me please!?

This works partially for me (it changes the issuetype but has problems with the workflow:

---------------

def cf = issue.get ("customfield_14840") as String

if (cf.find ("IS PROBLEM"))
{
   def newIssueType = ComponentAccessor.issueTypeSchemeManager.getIssueTypesForProject (issue.projectObject) .find {it.name == "Incident"}
   if (newIssueType) issue.setIssueTypeObject (newIssueType)
}
else
{
   def newIssueType = ComponentAccessor.issueTypeSchemeManager.getIssueTypesForProject (issue.projectObject) .find {it.name == "Service request with Eventual approval"}
   if (newIssueType) issue.setIssueTypeObject (newIssueType)
}

----------------

I researched a lot and couldn't find a solution that works :(

1 answer

0 votes
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 8, 2020

You can't just change the issue type.  You need to go through the whole "move" process, unless the target issue type is configured to use the same fields and workflow.

wiisoftware-corp May 8, 2020

Thanks for the answer!

That's what I need to do for Groovy.

I created a service catalog structure in Insight and I have a single form in the customer portal to open different types of issues.

Do you or anyone have a script that changes the link of the workflow?

Thank you!

Suggest an answer

Log in or Sign up to answer