Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

create multiple form for a particular Request types

manmohan_adhikari December 23, 2019

How can I generate custom sub fields based on  the previous field selected in the request form based on dropdown selection

2 answers

0 votes
Andrew Morin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 23, 2019

We use the Dynamic Forms add-on heavily for this type of thing. The add-on is solid with excellent support. The pricing got a little heavy handed for Jira Data Center customers with the new model but there is not much we can do about that. Still reasonable price for server customers. Not sure what you are running but this add-on provides a lot of rich features for dynamic fields and dynamic tabs. 

0 votes
brbojorque
Community Champion
December 23, 2019

You probably have the same issue with this guy here.

https://community.atlassian.com/t5/New-to-JSD-questions/Restrict-custom-field-values-in-Request-Type-groups-in-customer/qaq-p/1256260#M444

I did a bit of tinkering myself and the problem is I can't get the Customer Request Type in the create screen. 

The workaround is to detect the issuetype and then based on that the dropdown will change.

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.customfields.option.Option
def issueField = getFieldByName("Server")


// Get the current issue type
def issue = getIssueContext()

// Get the current user
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def optionsManager = ComponentAccessor.getOptionsManager()

def customField = customFieldManager.getCustomFieldObject(issueField.fieldId)
def config = customField.getRelevantConfig(getIssueContext())

def options = [:]
def listOpt = []

if(issue.getIssueType().name == 'Service Request'){ // IssueTypes inside Confluence Group
listOpt = ["Server 1", "Server 2"]
}else if (issue.getIssueType().name == 'IT Help'){ //IssueTypes inside Jira Group
listOpt = ["Server 3", "Server 4"]
}

options = optionsManager.getOptions(config).findAll{ it.value in listOpt }
issueField.setFieldOptions(options)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events