- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2024 12:17 PM
Hi,
Recently, I tried to check values of a field in UI Policy script, but it didn't work while it works in Client script. I was wondering about this behavior. Can someone please help me understand this.
Attaching screenshot for reference
The same code works in client script
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2024 10:16 PM
You can do field value validation in UI Policy Scripts as well but if you want to do the validation in real-time without save, you need to make use of On-Change Client Script. If you want the validation to happen post save, you can make use of UI Policy Scripts. Refer below screenshot where I configured the UI policy as per your screenshots and it only fires when I change the category and save the record :
Thanks and Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2024 07:51 PM
Hi @virajsapte99,
Can you elaborate on what you mean by it's not working?
But from what I can see, line 3 of the UI Policy script looks incorrect.
It should be g_form.getValue('category') instead of g_form.category
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2024 08:08 PM
I could see an error in your UI policy script on line 3. Could you please have a look on that ? It should be g_form.getValue('category');
Thanks and Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2024 10:36 PM
Hi @James Chun & @Amit Verma ,
Thank you for taking out time to respond. I have already fixed it but still it doesn't work. My concern is whether field value validation works in UI Policy scripts?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2024 01:14 PM
Hi @virajsapte99,
Can you elaborate on what you are trying to do and its purpose?
I guess you can do some data validation with UI Policy by throwing some error messages and/or clearing the values of the fields. But you won't be able to prevent a form submission.