I have a behavior running that shows/hides a field(single text) on the basis of an option - "CRO" selected in the single select field.
My requirement is that I want the field(single text) should be mandatory when "CRO" is selected in the single select field but if anything else is selected it should be optional.
How can I do it? I used behaviours again but that did not work-
def selectCFValue = getFieldByName("Requesting Segment")
def targetField = getFieldByName("Requesting Business Unit")
if (selectCFValue.getValue() == "CRO")
targetField.setRequired(true)
else
targetField.setRequired(false)
Can anyone help?
Hey @Priyanka khare
Maybe I'm misunderstanding it here but from your behaviour it looks like you are trigger on on the changing of the "Requesting Business Unit" field?
If that is changed it needs to check if CRO is the value and then set the targetfield required.
If it is triggering you can always check the logs.
personally I would also try and do some log.error messages just to debug (don't forget to add curly braces then in your if)
hello @Dirk Ronsmans ,
This behaviour does nothing. I added the curly braces and still no action.
Regards,
Priyanka
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
And the fact about the changing of the Requesting Business Unit is that correct?
I would still suggest to add something like
log.error selectCFValue.getValue()
and check the logs to see if the If statement is even triggering. also adding some log.error "some message" on the first line would be an easy way to make sure that the behaviour is even triggering at all.
Troubleshooting these things can be annoying so also double check if there is anything in your browser developer console, that might give you some clues.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Priyanka khare,
The script looks fine. but the configuration does not meet your requirement
you've added the script as "server side script" of "Requesting Business Unit" which means your script will be executed only if the target field gets changed
you just need to place the same script as server side script of "Requesting Segment" field to get it working
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.