Hello everyone! I have a workflow with some transition and many types of queries for this WF. But I want to hide the transition for some request type. How can i do this?
Maybe i can use "Custom script condition [ScriptRunner]" ?
Enybody can show exapmle?
Thanks to all!
I used Simple Script Condition with code:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueManager
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def requestTypeCf = customFieldManager.getCustomFieldObject("customfield_your CF ID") issue.getCustomFieldValue(requestTypeCf).value ! = "ID of your Request Type"
Works great for me!
This seems to be the cleanest, easiest solution. Thank you!
Note that "ID of your Request Type" can be found a couple ways. Easiest is probably to export an issue with the desired Customer Request Type to XML, then searching for "customer request type."
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Pavel Rusakov ,
you are right! You can use Custom scripted condition provided by script runner.
Here an example.
Custom Field = TEXT
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.fields.CustomField;
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();
CustomField cf = customFieldManager.getCustomFieldObjectByName("YOUR_CUSTOM_FIELD_HERE");
String cfValue = issue.getCustomFieldValue(cf)!=null?issue.getCustomFieldValue(cf).toString():null;
if("YOUR_CF_VALUE_HERE".equalsIgnoreCase(cfValue)){
return false;
}
return true;
Custom Fied = SelectList
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.customfields.option.Option;
import com.atlassian.jira.issue.fields.CustomField;
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();
CustomField cf = customFieldManager.getCustomFieldObjectByName("YOUR_CUSTOM_FIELD_HERE");
String cfValue = issue.getCustomFieldValue(cf)!=null?((Option)issue.getCustomFieldValue(cf)).getValue():null;
if("YOUR_CF_VALUE_HERE".equalsIgnoreCase(cfValue)){
return false;
}
return true;
Hope this helps,
Fabio
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can use custom script condition.
And below is the script getting the request type of the issue and checking with the one you want. Place user accordingly.
I hope it helps
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.servicedesk.api.requesttype.RequestTypeService
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
@WithPlugin("com.atlassian.servicedesk")
def requestTypeService = ComponentAccessor.getOSGiComponentInstanceOfType(RequestTypeService)
def reqQuery = requestTypeService.newQueryBuilder().issue(issue.id).build()
def reqT = requestTypeService.getRequestTypes(user, reqQuery)
def requestTypeName = reqT.getResults()[0].getName()
if("YOUR_REQ_TYPE_NAME_HERE".equalsIgnoreCase(requestTypeName)){
return false;
}
return true
I haven't tested the code, but I think it would help. Let me know if you have any issues.
Tuncay
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.