Forums

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

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 Champion
November 6, 2018 edited

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
atlassian, jira cloud certification, managing jira projects, jira project administration, jira cloud exam, atlassian certification, agile project management, jira workflows, jira permissions, jira training, jira cloud skills, atlassian learning

Become a Certified Jira Service Project Expert 🦸🏻‍♂️

Validate your expertise in managing Jira Service Projects for Cloud. Master configuration, optimize workflows, and manage users seamlessly. Earn global 🗺️ recognition and advance your career as a trusted Jira Service management expert.

Get Certified! ✍️
AUG Leaders

Atlassian Community Events