Is there any known issue/work around needed in ScriptRunner workflow post function - "Fast-track transition an issue post function" using 7.2.7 JIRA s/w version ?

Manjunatha K R March 22, 2017

All,

Is there any known issue/work around needed in ScriptRunner workflow post function - "Fast-track transition an issue post function" using 7.2.7 JIRA s/w version as same script works perfectly fine with older JIRA version i,e 6.7.16.

I am getting the below error using the Auto Clone script posted below after upgraded my JIRA s/w to 7.2.7 version from 6.7.16 JIRA version.

But same script works perfectly fine, when I was using my old JIRA 6.7.16 version and Adaptavist ScriptRunner for JIRA is 4.3.16.

org.ofbiz.core.entity.GenericTransactionException: Commit failed, rollback previously requested by nested transaction.

Right now I am Using Adaptavist ScriptRunner for JIRA is 4.3.16 and JIRA s/w version is 7.2.7.

My workflow is as below::

Create-> Eng Supp -> Eng Assigned -> Eng Fixed -> Closed.

The below posted post function "auto clone" script is added as part of "Eng Fixed" transition's post function, when we transition from Eng Assigned state. On post transition to Eng Fixed, Clone Issue(s) will be created based on some custom field values updated in it and linked to the original issue using "is Cloned by" link as per the above script.

But in "Create-> Eng Support" transition's post function, I added one another Fast-track transition an issue post function - but same is working in my older version JIRA 6.7.x before JIRA upgrade was done to 7.2.7 version and giving the below ERROR.

2017-03-23 13:10:28,519 ERROR [utils.WorkflowUtils]: Errors: {}
Error Messages: [Error occurred while creating issue. This could be due to a plugin being incompatible with this version of JIRA. For more details please consult the logs, and see: http://confluence.atlassian.com/x/3McB java.lang.String cannot be cast to java.util.Collection]
Start of logs truncated as they exceeded 300 lines.

Right now I am using Adaptavist ScriptRunner for JIRA is 4.3.16 and JIRA s/w version is 7.2.7.

Fast-track transition an issue post function is as below::

Condition::

cfValues['Defect Source']?.value == 'ITG' || cfValues['Defect Source']?.value == 'ITG-Traffic' || cfValues['Defect Source']?.value == 'MTG_TRAFFIC' || cfValues['Defect Source']?.value == 'ITG-Automation' || cfValues['Defect Source']?.value == 'Design Server' || cfValues['Defect Source']?.value == 'MTG' || cfValues['Defect Source']?.value == 'FOA' || cfValues['Defect Source']?.value == 'Requirements' || cfValues['Defect Source']?.value == 'System Engineering'

Action: Assign to Engineering (231)

 

If I remove the above Fast-track transition an issue post function, Cloning of issues will work in my Eng Fixed post function script works perfectly fine and Cloned issues will remain in Eng Supp state only as I removed the above Fast-track transition an issue post function.

But I need the above Fast-track transition an issue post function to transition the issues from Eng Supp to Eng Assigned in the condition I added as part of the above Fast-track transition an issue post function.

Due to which I am unable to create cloned issues and link it, using another post function in my workflow.

Same works in my older version JIRA s/w. Please suggest what is causing this issue in new JIRA version used.

Is there any known issue/work around needed in ScriptRunner workflow post function Fast-track transition an issue post function using 7.2.7 JIRA s/w version ???

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.link.DefaultIssueLinkTypeManager
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.link.IssueLinkManager
import com.atlassian.jira.issue.link.IssueLinkType
import com.atlassian.jira.issue.link.IssueLinkTypeManager
import com.atlassian.jira.issue.customfields.option.LazyLoadedOption
import com.atlassian.jira.issue.customfields.option.Option
import com.atlassian.jira.issue.customfields.view.CustomFieldParams
import com.atlassian.jira.issue.search.SearchProvider
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.user.util.UserManager
import com.atlassian.jira.issue.IssueManager
 
log.setLevel(org.apache.log4j.Level.DEBUG)
 
Issue issue = issue
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
 
String componentValue = null, relPrimeVal= null;
 
IssueLinkTypeManager issueLinkTypeManager = ComponentManager.getComponentInstanceOfType(IssueLinkTypeManager.class)
 
def Priority = issue.getPriority()
def Asignee = issue.getAssignee()
 
for (int i =0 ; i < casecadingValueCount; i++){    
    def issueFactory = ComponentAccessor.getIssueFactory()
    def issueManager = ComponentAccessor.getIssueManager()
    def newIssue = issueFactory.cloneIssue(issue)
 
    newIssue.setPriority(Priority)
     
    newIssue.setSummary("CLONE - $issue.summary")
    newIssue.setProjectId(issue.projectId)
    newIssue.setDescription(issue.description)
    newIssue.setAssigneeId("Asignee")
     
 
    Map<String,Object> newIssueParams = ["issue":newIssue] as Map<String,Object>
    issueManager.createIssueObject(currentUser, newIssueParams)
     
           
    IssueLinkManager linkManager = ComponentAccessor.getIssueLinkManager()
    //Issue testGroupIssue = issueManager.getIssueObject(issue.id);
    //Issue testGroupIssue1 = issueManager.getIssueObject(newIssue.id);
     
    Collection<IssueLinkType> issueLinkTypes1=ComponentAccessor.getComponentOfType(IssueLinkTypeManager.class).getIssueLinkTypes();
    String linkID=null;
    for (IssueLinkType linktype : issueLinkTypes1) {
        String name=linktype.getName();
        log.warn("Issue Link Type Name : " + name);
        String id=linktype.getId();
        log.warn("Issue Link Type Id : " + id);
         
        if(name.equals("Cloners")){// change link name here
            linkID=linktype.getId();
            break;
        }
    }
    log.warn("Issue Link Types : " + IssueLinkType)
    log.info("createIssueLink: i")
    log.info(i)
     
    linkManager.createIssueLink(newIssue.getId(), issue.getId(), Long.parseLong(linkID),Long.valueOf(0), currentUser);
            
}//selectedComponents or for loop end

 

  • Manju

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
JamieA
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.
March 28, 2017
0 votes
JamieA
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.
March 28, 2017

Can you try it without the additional code, if that works introduce it back bit by bit and see where it breaks.

Manjunatha K R March 29, 2017

Hi Jamie,

The above posted my "Auto Clone" Script works perfectly fine, when I remove the below "Fast Track Transition condition, Action" in my workflow.

Condition::

cfValues['Defect Source']?.value == 'ITG' || cfValues['Defect Source']?.value == 'ITG-Traffic' || cfValues['Defect Source']?.value == 'MTG_TRAFFIC' || cfValues['Defect Source']?.value == 'ITG-Automation' || cfValues['Defect Source']?.value == 'Design Server' || cfValues['Defect Source']?.value == 'MTG' || cfValues['Defect Source']?.value == 'FOA' || cfValues['Defect Source']?.value == 'Requirements' || cfValues['Defect Source']?.value == 'System Engineering'

Action: Assign to Engineering (231)

 

Now my question is, the above condition was working fine in my previous JIRA version i,e 6.7.16 successfully and same has been followed based on the below options present in the Jira/Script runner post function example:

Fast-track transition an issue ->

Has select list value equal to

cfValues['My Select List']?.value == 'My value'

But now i am using 7.2.7 JIRA s/w version and started failing using the ERROR posted above..

  • Manju
Manjunatha K R March 29, 2017

Even otherway to isolate the issue, I removed my Auto Clone post function script and kept only "Fast Track Transition condition, Action" in my workflow.

Even in this case i am getting same error.

2017-03-23 13:10:28,519 ERROR [utils.WorkflowUtils]: Errors: {}
Error Messages: [Error occurred while creating issue. This could be due to a plugin being incompatible with this version of JIRA. For more details please consult the logs, and see: http://confluence.atlassian.com/x/3McB java.lang.String cannot be cast to java.util.Collection]
Start of logs truncated as they exceeded 300 lines.

Right now I am using Adaptavist ScriptRunner for JIRA is 4.3.16 and JIRA s/w version is 7.2.7.

JamieA
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.
March 30, 2017

Does it work if you run the transition through the UI? Can you send a screenshot of the fast-track config?

Manjunatha K R March 30, 2017

Yes Jamie, If I remove the "Fast Track Transition condition, Action" in my workflow - Auto Clone works perfectly fine.

Notworking post function ScreenShot.PNG

JamieA
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.
March 30, 2017

But does Assign to Engineering work? To be honest I've lost track of what doesn't work here, clone issue or fast-track...?

Manjunatha K R March 30, 2017

That's fine Jamie, your support is really appreciated for me.

Assign to Engineering will not work as I have removed the Fast Track Transition condition. And clone issues works and issues will remain in Eng Support only (means not transitioned to Assign to Engineering state)

If I add the "Fast Track Transition condition, Action" in my workflow - I will get the ERROR attached in the screen shot/FYR.

INT-6717 Screen shot2 ERROR.PNG

TAGS
AUG Leaders

Atlassian Community Events