Making a tab mandatory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2024 12:05 AM - edited 09-02-2024 12:14 AM
hey
I want a certain condition when a field in the incident form is equal to the value 5
A section will become mandatory and the fields it contains will also become mandatory.
thanks, Shir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2024 03:43 AM
okay.
Try with the following client script:
Type : on change
Field name : Unit(u_unit)
Script :
if ((g_form.getValue('u_unit') == '6');
{
g_tabs2Sections.markMandatoryTabs();
}
Considering you had written UI policies for same condition to mark field mandatory.
so keep order of client script bit higher than UI policy.
Thanks,
Rohit Suryawanshi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2024 03:50 AM
Where exactly do I write the name of the section in the line of code?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2024 06:13 AM
Can you please share screenshots of your code/UI policies.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2024 02:34 AM
Did you got a chance to look on the below posts :
https://www.servicenow.com/community/developer-forum/mandatory-fields-on-a-tab/m-p/1474047
Alternatively, you can look into the below link to understand more about g_tabs2Sections.markMandatoryTabs() :
https://www.servicenow.com/community/developer-blog/demystifying-form-tabs/ba-p/2287086
Thanks and Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.