Hi All,
I'm looking to see if my script can be improved for the following needs, I have a single choice drop down (yes, no). When 'No' is selected, I need to remove all of the required fields listed in the script.
When I first created this, it worked, but for some odd reason it's no longer working. Could someone look over my script and tell me if there is something that sounds out as not functioning?
Thanks!
How about something like this:
def fieldList = [
'File Submitted Date',
'Requested Date of Transfer',
'Media to Client',
'Tran 119',
'Is a TLP required',
'Should TLP fees be billed to the client',
'Does the client need Tax amounts for these loans?',
'Change Contract Service_Type',
'Do you need TPS Recon?',
'Do you need a WI options listing',
'Is a bene fee to be charged',
'Fee Type(s) Change Needed?'
]
def selectList = getFieldByName("Will there be a BENE final?")
def selectListValue = selectList.getValue()
fieldList.each { fieldName ->
def hide = selectListValue == "No"
getFieldByName(fieldName).setHidden(hide).setRequired(!hide)
}
Thank you @Peter-Dave Sheehan
I'll give it a try and see if it works for me. I'll report back on the status.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Any idea as to why it's causing an error? When the option "No" is selected, it's not removing the required function from those fields
Error
There are fields that are required or in an error state, but the administrator has hidden them or made them readonly using a behaviour.
Thanks!
Norm
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For fields to be conditionally required using behaviour, they can't be required in other configurations.
Check the field configuration scheme and make sure the field is optional there.
Note that this is one of the downsides of behaviour. It only works on screens and requires the underlying API to open. So if you do this, the screen may show the field as required, but someone interacting with the API will be able to submit issues without that field. On the other hand, using the field config scheme to make a field required will also make it required via the api.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I see, currently the fields are set to required in the field configuration, would I need to remove the required fields from the field configuration so the behaviour you provided enables it properly?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Correct. The field must be optional in the field configuration if you want to use behaviour to conditionally make it visible/required or hidden/optional.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.