- 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-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-20-2024 12:00 AM
Hi @virajsapte99,
Could you please make the correction in line no.3 as g_form.getValue('category'); instead of g_form.category=='category'; Even after correcting this if it does not work then copy the code and paste in script in Execute if false in below. Please try this and hope this will work.
Thanks
Jitendra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2024 02:14 PM - edited 05-21-2024 12:37 AM
Hi @virajsapte99 ,
I can see that you have created a onchange client script and you are trying the same script in onload ui policy which might not work once you change the Category value so if you want your ui policy to work on onchange aswell then uncheck the Field called OnLoad in ui policy then it will work as onchange of field, let me know if this works or not.
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang