set field mandatory based on another fields' value in record producer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2024 10:26 AM
Hello,
i want to set a field to be mandatory depending on another field's value in the record producer.
the other field is a choice list.
i added this client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2024 10:47 AM
Hi @ammar_k
Can you try using UI Policy. please refer below link:
https://www.servicenow.com/community/developer-forum/how-to-make-a-field-mandatory-based-on-a-choice...
also can you share me the screenshot of your client script condition
……………………………………………………………………………………………………
Please Mark it helpful 👍and Accept Solution✔️!! If this helps you to understand.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2024 12:47 PM
Hi @ammar_k,
I tried your code in my pdi its working properly, can you please share some snaps of you onchange ? and put alert for caseType and share the screenshot of alert?
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2024 09:38 PM
Hi there,
Any specific reason you are trying this with a Client Script? Have you considered using a UI Policy without using any code?
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2024 10:44 PM
@ammar_k - You can try this with UI policy.