UI Policy with setValue not setting the correct value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2024 06:56 AM
I've got the following UI policy for a catalogue item that is used to update the value of a certain field when the conditions are met:
The script of the UI Policy is:
However, what I'm finding is that if I go onto my catalogue item and trigger the UI Policy, it's not setting the to field to Not Applicable, but Read Only:
So I was just wondering if anyone knows why the text specified in SetValue is not working as it should?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2024 07:02 AM - edited 02-13-2024 07:08 AM
Hi @matthew_hughes
Seems like you are using the setValue to the choice field, so make sure you're using the backend value to set the value in the field.
g_form.setValue('u_toxic.......' , 'not_applicable'); //make sure to write the backend value here
Also, make sure the UI policy is working. To check please add the alert to confirm and disable the ui policy action
Please mark helpful if this resolves your query
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2024 12:28 AM
Hi @_Gaurav
Hi @Community Alums
I've now made two UI Policies:
Whilst it does make the field Read only when it correctly should, it's not adding the value of 'Not Applicable'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2024 12:32 AM
Hi @matthew_hughes
u_toxic field is a choice field, so why don't you add the choice question under the field itself and try to set the value from the UI Policies?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2024 12:37 AM - edited 02-14-2024 12:42 AM
I've added the choice back in, but when I don't want it to appear, it's started appearing:
I don't want it to show in this scenario