- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2022 04:26 AM
Hi all i am building an if condition and i want to add a condition where it checks if a particular field is mandatory
How can i achieve this
Thank you in advance
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2022 01:10 AM
Use following code to get the list of Mandatory fields which are not filled by a user on the form in a client script.
var arr = g_form.getMissingFields();
Source: https://community.servicenow.com/community?id=community_blog&sys_id=a95d6629dbd0dbc01dcaf3231f961982

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2022 04:31 AM
Check out this article:
https://community.servicenow.com/community?id=community_blog&sys_id=a95d6629dbd0dbc01dcaf3231f961982
Following this approach, you check if the array contains your field.
Please mark Correct and Helpful if my answer helps you resolve your issue. Thanks!
Martin Ivanov
Community Rising Star 2022
Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Martin Ivanov
ServiceNow MVP 2023, 2024

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2022 05:05 AM
Hi. If my answer has helped you resolve your issue, Please mark Correct and Helpful. This way, other users may also benefit from the thread. Thanks!
Martin Ivanov
Community Rising Star 2022
Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Martin Ivanov
ServiceNow MVP 2023, 2024

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2022 01:10 AM
Use following code to get the list of Mandatory fields which are not filled by a user on the form in a client script.
var arr = g_form.getMissingFields();
Source: https://community.servicenow.com/community?id=community_blog&sys_id=a95d6629dbd0dbc01dcaf3231f961982