Getting errors while using setHidden and setRequired

Akbar N October 29, 2018

Hi, We need to display a multi-line text filed based on a value selected in select custom field in Jira. I have following code using scriptRunner Script field. 

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.resolution.Resolution

 

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def optionsManager = ComponentAccessor.getOptionsManager()

/* Get the custom field names for select and text fields*/

def complianceReviewNotRequiredField = customFieldManager.getCustomFieldObjectByName("Compliance Review not required")
def complianceReviewField = customFieldManager.getCustomFieldObjectByName("Compliance Requirement")

/* check the custom select value is selected as Approval Not Needed*/

def selectedOption = complianceReviewField.getValue(issue).toString()
def isOtherSelected = selectedOption == "Approval Not Needed"

if(selectedOption == "Approval Not Needed"){
complianceReviewNotRequiredField.setHidden(false)
complianceReviewNotRequiredField.setRequired(true)
}

 

 

1 answer

0 votes
Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 6, 2018

Hi Akbar,

Thank you for your question.

I can confirm that it is not possible to dynamically restrict, hide or show fields using ScriptRunner for Jira Cloud like you can do with ScriptRunner for Jira Server using the Behaviours module which the server version provides. You can see a full list of the differences between the two versions here.

This means that we are currently unable to provide the Behaviours functionality in JIRA cloud to dynamically restrict fields due to the fact that the API and functionality which Atlassian provide in JIRA Cloud is much more restricted than the API which they provide in JIRA Server.

If this response has answered your question can you please mark it as accepted so that other users searching for a similar question can see that this is a correct answer.

Regards,

Kristian

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events