How can I generate custom sub fields based on the previous field selected in the request form based on dropdown selection
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.
You probably have the same issue with this guy here.
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)
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.