Hey all,
I have been trying to set a field to read only if another custom field equals a specific value.
What I have: (I'm new to groovy so be nice :P)
import com.atlassian.jira.component.ComponentAccessor
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def resultsType = getFieldById("customfield_12051")
def archive = getFieldById("customfield_12155")
if (resultsType.getValue() == 'Direct')
{
archive.setReadOnly(true)
}else{
archive.setReadOnly(false)
}
Got it working with a server side script but it won't work on initialisation. I'm sure I read somewhere that on initialisation custom field values cannot be read?
Thanks
Hi @Hunter1428
Welcome to the groovy world where everything is nearly possible !
Just couple of question to better understand the issue here:
Thanks for such a super fast response!
Here are my answers to your questions :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try this
if (resultsType.getValue().toString() == 'Direct')
{
archive.setReadOnly(true)
}else{
archive.setReadOnly(false)
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Still nothing, it works on the Server side script but not on the Initialiser :(
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.