HI,
I have a custom field called "Is Change Required?" which has "Yes" and "No" as options. If the response is "Yes" I would like to automatically assign the label "ChangeRequired" to the ticket. The question is on a request through a Service Desk Portal.
How do I do this using either a postfunction or a behaviour?
I am on Jira Data Center so I do not have access to the Autonation Plugin unfortunately.
Hi @Anuj Balaji
I am not sure about the Service Desk Portal-part but for a postfunction in a workflow using Script Runner it works fine in my tests like this (Groovy):
import com.atlassian.jira.issue.label.LabelManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.Issue
def user = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser()
CustomField radioButton = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Change");
if(radioButton == null)
return false
if(radioButton.getValue(issue).toString().equals("yes"))
{
LabelManager mgr = ComponentAccessor.getComponent(LabelManager.class)
mgr.addLabel(user, issue.id, 'ChangeRequired', false)
}
else
{
return false
}
As soon as the issue has the value "yes" for the Custom Field "change" a label is set during a transition of your choise using a post function.
You might need to tweak it a bit for Custom Field names and possible further requirements that might come up in future - the above one is pretty basic.
Regards,
Daniel
Hi @Anuj Balaji
Install Automation of Jira Lite and have automation work done for you!
You can set the automation as follows,
If the custom field is changed, you can edit the label field.
Thanks,
Pramodh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Pramodh M : Thanks for responding. Like I said, unfortunately, Automation for Server Lite does not work on Data Center.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you @Pramodh M - I was hoping to exhaust all my options with Scriptrunner before having to spend the money on the Plugin.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I would still like to keep this open for other potential solutions
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.