Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,300,749
Community Members
 
Community Events
165
Community Groups

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

Marketplace Partner Spotlight: AppLiger

This month the spotlight is on AppLiger. We caught up with Pavel Pavlovsky, CEO and Product Manager, to learn how the company started and what fuels the team's creativity.    Atlassian:...

405 views 0 7
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