Examples for Moving Workflow via postfunction plugin

Eva
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.
August 15, 2011

I am trying to create a plugin that would move the transition of the linked ticket that was related to this current issue. For example, there is a TEST-123 is linked to HOT-222 (sorta like parent of TEST-123). When TEST-123 is in "Development" status of the workflow, I would like HOT-222 to be updated to "Development" as well.

I am looking for examples to how to move the transition as I know how to set the status manually.

Thank you in advance!

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Jobin Kuruvilla [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.
August 15, 2011

Interestingly, the same was answered earlier today here.

Eva
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.
August 15, 2011

Thanks :) I also found examples from Script Runner Plugin site. I wish the Answer site can search better b/c that's somethign I was worry about -- that it's been asked and I just couldnt find it.

Srividhya April 9, 2012

Hi Jobin,

I am following your book for WorkflowTransition .It was great .

But I am using Jython to implement this .When I say

tranitionValidRes.isValid() -it resturns me a false.

Why so ? any reason

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.
April 9, 2012

And see https://studio.plugins.atlassian.com/wiki/display/GRV/Built-In+Scripts#Built-InScripts-Fasttracktransitionanissue from the script runner plugin, which can transition an issue based on some condition.

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.
April 9, 2012

See getErrorCollection() on the same object for why not.

Srividhya April 9, 2012

this is the code ,

Please point if I am missing something

workflowObj = ComponentManager.getInstance().getWorkflowManager().getWorkflow(issue)

status = issue.getStatusObject().getGenericValue()

currentStep = workflowObj.getLinkedStep(status)

issueServiceObj = ComponentManager.getInstance().getIssueService()

issueParamImpl = IssueInputParametersImpl()

issueParamImpl.setAssigneeId(currUserName)

issueId = issue.getId()

System.out.println("Issue Id RFS:"+str(issueId))

actId =0L

actions =[]

actions = currentStep.getActions()

for action in actions:

System.out.println("Action:"+action.getName())

actionName = action.getName().strip()

if(actionName == 'Done by BS-ITALY'):

actId = action.getId()

transValiRes = issueServiceObj.validateTransition(currUser,issueId,91,issueParamImpl)

System.out.println("Transition Id valid")

System.out.println("transition Valid boolean :"+str(transValiRes.isValid()))

if(transValiRes.isValid()):

System.out.println("Transition validated")

transitionResult = issueServiceObj.transition(currUser,transValiRes)

System.out.println("Moving to Done by Italy")

else:

System.out.println("Moving to Done by Italy in else")

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.
April 9, 2012

See getErrorCollection() on the same object for why not.

Jobin Kuruvilla [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.
April 9, 2012

@srividhya-r Good to know about the book :) Regarding the error, please follow Jamie's advice. There must be some error preventing you to do the transition.

Srividhya April 16, 2012

Hi ,

I found that the transition is not happening due to the reason explained in this page https://answers.atlassian.com/questions/24245/why-is-jira-saying-that-a-perfectly-valid-transition-for-my-issue-is-invalid

So what can be done to make the workflow to be in "Activated" state ?

Thanks,

Srividhya

TAGS
AUG Leaders

Atlassian Community Events