Forums

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

Scriptrunner Behaviours not working for all users

Jurica Petricevic
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.
June 1, 2023

Hi Community,

 

as before, in many places I used this side script to make a connection between two or more fields or their dependency, but now I noticed that this script works exclusively and only for system admins and normal users, there are no required restrictions in this script at all. I don't understand how and why it happened at all? Can I help a little?

 

Best regards

 

def regulatoryRequirementNew = getFieldByName('Regulatory Requirement New')

def regulatorischeAnforderungen = getFieldByName('regulatorische Anforderungen')

def endDate = getFieldByName('End Date')


String
regulatoryRequirementNewValue = regulatoryRequirementNew.getValue()


if(!regulatoryRequirementNewValue.startsWith("Keine Auswahl")){

regulatorischeAnforderungen.setRequired(true)

endDate.setRequired(true)

} else {

regulatorischeAnforderungen.setRequired(false)

endDate.setRequired(false)

}

1 answer

1 accepted

0 votes
Answer accepted
Jurica Petricevic
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.
June 2, 2023

Problem was that objectnames and getFieldbyName have a problem coz not all Users user same language in Jira. This solved my problems:

 

import com.onresolve.jira.groovy.user.FormField

def regulatoryRequirementNew = getFieldById("customfield_16100")

FormField endDate = getFieldById("customfield_13651")

FormField regulatorischeAnforderungen = getFieldById("customfield_13203")

String regulatoryRequirementNewValue = (String) regulatoryRequirementNew.getValue()

if(!regulatoryRequirementNewValue.equals("Keine Auswahl")){

regulatorischeAnforderungen.setRequired(true)

endDate.setRequired(true)

} else {

regulatorischeAnforderungen.setRequired(false)

endDate.setRequired(false)

}

Suggest an answer

Log in or Sign up to answer