I have a scenario where I need to restrict the Summary from being edited if a certain field is set to "Yes". I've tried to canvas the community for examples and have one that I thought would work, but I am not getting the results I expected.
if(!getFieldById("customfield_19114").getValue().equals("Yes")){
getFieldById("summary").setReadOnly(true)
}else{
getFieldById("summary").setReadOnly(false)
}
The custom field is a single-select Radio button and I just cannot get this to work.If anyone can help, I'm eternally grateful. And, if you able to help, I have another piece to this puzzle, that I use help with. If the value of the custom field is "Yes", then I want the Summary to be read only, but not for users in a specific role. Now, I believe if I can get the initializer set, then I can use the field conditions to control the users who can edit. I may just need some confirmation on this.
Thanks for your help!
Hi @Thomas Hardin,
Below snippet will work for you to set summary readonly once field value is set
Map the Custom Field with behaviour and built server side script for the same with below code
def ro = getFieldById(getFieldChanged()).getValue() == "Yes"
getFieldById("summary").setReadOnly(ro)
Hope this helps you
BR,
Leo
Hi @Leo , I may be a bit lost and I may not have fully presented my scenario. But, I so not understand how the snippet would work in the initialize. In the case you provided, am I correct in that the field that changed (ro) is the same field we use to set read only? I thought Read Only was set to either True of False?
In my scenario, the field that should trigger the Summary to be Read Only is a "EOT Initiative", which is a radio button. If EOT Initiative = Yes, then we need to set the Summary to Read Only.
I truly appreciate your assistance on this and apologize for my lack of understanding.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Thomas Hardin,
Yep, that is what above 2 lines are doing. setting summary to read only based on your custom field(EOT Initiative)
1. choose EOT Initiative for new behaviour
2. Select server side script
3. place those 2 lines
"getfieldchanged()" is the method to get field ID of associated/mapped field
so indirectly we are getting your custom field here, if you want you can replace it with yours like below
def ro = getFieldById(customfield_19114).getValue() == "Yes"
getFieldById("summary").setReadOnly(ro)
And in the first line if you notice I'm assigning value of getValue() == "Yes"
which means the variable "ro" will store either true or false
and in the 2nd line using ro value on summary field to enable/disable readonly option
Hope this helps
BR,
Leo
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.