I'm new to the script runner plug in.... this is what I am trying to do:
We have a custom field called: discipline that is a drop down list.. where you can only select 1 option.
When the person entering the ticket selects discipline = QA for example..
I want the ticket to automatically move to the QA review que.. instead of the initial status.
Here are the 2 lines that I have attempted so far:
assert cfValues['Discipline']== ('QA')
cfValues['Discipline']== ('QA')
and then I found the custom field ID: id=12200
Thanks,
Rob Lazorchak
I would suggest using a SR workflow fast track post-function. This post function will live on the 'Create' transition. It will automatically forward certain issues (based on your condition) to a specific status. Setup your condition similar to this:
cfValues['My Select Field'] == "Option Name"
Thanks for the reply... This is what I have:
cfValues['Discipline'] == "QA"
Then action is To QA Review (711)
With a comment in the additional issue actions section.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
From Post functions editor:
Fast-track transition an issue (condition & additional actions apply)
Action: To QA Review (711) will be applied
Note that this should go after the Fire Event function.
Fast track an entered issue to QA
Then in the payload I don't see any mention of this being called:
{
"full.module.key": "com.onresolve.jira.groovy.groovyrunnerrungroovy-function (java.lang.String)",
"canned-script": "com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.FasttrackTransition (java.lang.String)",
"class.name": "com.onresolve.jira.groovy.GroovyFunctionPlugin (java.lang.String)",
"issue": "TO-28 (com.atlassian.jira.issue.IssueImpl)",
"passesCondition": "true (java.lang.Boolean)",
"transientVars": {
"issue": "TO-28 (com.atlassian.jira.issue.IssueImpl)",
"configuration": "com.opensymphony.workflow.config.DefaultConfiguration@15773e85",
"issueProperties": "{} (com.google.common.collect.EmptyImmutableBiMap)",
"currentSteps": "[SimpleStep@27[owner=, actionId=0, status=open]] (java.util.ArrayList)",
"store": "com.opensymphony.workflow.spi.ofbiz.OfbizWorkflowStore@47fbb579",
"descriptor": "com.atlassian.jira.workflow.ImmutableWorkflowDescriptor@dcb6a0b",
"entry": "com.opensymphony.workflow.spi.SimpleWorkflowEntry@c062238",
"oldStatus": "IssueConstantImpl[[GenericEntity:Status][sequence,8][statuscategory,2][name,PM Review][iconurl,/][description,Program Manager Review. \nWhen tickets are in this status it means the Program manager is reviewing the ticket to make sure: \n1) This is a priority task that he wants to get completed. \n2) There is proper funding for the task. \n3) The task has the appropriate priority assigned to it.][id,10000]] (com.atlassian.jira.issue.status.StatusImpl)",
"context": "com.opensymphony.workflow.basic.BasicWorkflowContext@2d3ce1f6",
"createdStep": "SimpleStep@27[owner=, actionId=0, status=open] (com.opensymphony.workflow.spi.SimpleStep)",
"originalissueobject": "null (org.codehaus.groovy.runtime.NullObject)",
"actionId": "1 (java.lang.Integer)",
"pkey": "TO (java.lang.String)",
"changeItems": "[com.atlassian.jira.issue.history.ChangeItemBean@54740238[fieldType=jira,field=assignee,from=<null>,fromString=<null>,to=xxxx,toString=xxxxx,created=<null>], com.atlassian.jira.issue.history.ChangeItemBean@47cde318[fieldType=jira,field=status,from=10000,fromString=PM Review,to=10000,toString=PM Review,created=<null>]] (java.util.LinkedList)"
},
"log": "org.apache.log4j.Logger@28198289"
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Rob,
The condition provided by in the answer below should work for you:
- Script runner - Fast-track transition based on custom field value
Also, since you are not an experienced with groovy scripts, would you like to try a simpler solution for your case?
I believe that Automation for JIRA (300 free executions per month) would be more intuitive to update your issue status when a custom field is edited. You would just need a rule like the one below:
Please, let me know if the information above helps you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.