Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Need help with setting options of a custom field drop down list depending on Customer Request Type

I am trying to set a Jira custom field drop down based on Customer Request Type and I have been struggling to find a solution from a lot of days. I did my research online and was not helpful either. I am pasting my code I used in Initialiser in behavior script but I am unsuccessful can you please let me know where I am going wrong with this request. It is working on the create page of service desk. I am trying to implement this when we try to edit a page

 

import com.atlassian.servicedesk.api.requesttype.RequestTypeService
import com.atlassian.servicedesk.api.requesttype.RequestType
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.util.IssueChangeHolder
import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.bc.issue.IssueService;
import com.atlassian.jira.bc.issue.IssueService.CreateValidationResult;
import com.atlassian.jira.bc.issue.IssueService.UpdateValidationResult
import com.atlassian.jira.issue.IssueInputParameters;
import com.atlassian.jira.issue.IssueInputParametersImpl;
import groovy.json.*;
import com.atlassian.jira.issue.Issue;





FormField requestTypeField = getFieldById ("customfield_10171")
def reqType = getFieldByName("Customer Request Type")


    Map fieldOptions = [:]

    
    if (reqType == "oti/96384970-60f4-44e7-aaf5-93f1dcdab5a3") { 
 
    fieldOptions.put ("", "None")
    fieldOptions.put ("28739", "New Field/Case Request")
    fieldOptions.put ("28740", "New GNO Request")
    fieldOptions.put ("28741", "New Process Flow Request")
        fieldOptions.put ("14690", "Other")


}
  

    requestTypeField.setFieldOptions(fieldOptions)

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

345 views 3 14
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you