How to visible the section based on the subcategory or assignment group to visible the section.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-13-2022 02:28 AM
I have created record producer.In target record i have created one custom section and one field (i.e unmandatory).
i want to visible the my custom section and under the field should be mandatory in when subcategory is "Release" and Assignement group is "GRC solution" in target record.
could you please help me on this.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-13-2022 02:40 AM
Hi,
Depending on your requirement, you can create either a Catalog UI Policy, or a UI policy, with UI policy actions to hide/unhide sections and fields.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-13-2022 02:44 AM
Hello,
Use client script for that, see this blog, just add your field as well in same script
https://servicenowguru.com/scripting/client-scripts-scripting/showhide-form-section/
Please explore.
Regards
Regards,
Musab

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-13-2022 03:31 AM
Hi write a onChange client script on field SubCategory:
Script:
function onChange(control, oldValue, newValue, isLoading) {
//this example was run on a form divided into sections (Change form)
// and hid a section when the "state" field was changed
var sections = g_form.getSections();
var subCat = g_form.getValue('subcategory');
var group = g_form.getValue('assignment_group');
alert(sections); // check your section name you want to hide
if (subCat == '2' && group == 'sysid of group') {
g_form.setSectionDisplay(sections[1], true);
} else {
g_form.setSectionDisplay(sections[1], false);
}
}
Refer : https://docs.servicenow.com/bundle/sandiego-application-development/page/app-store/dev_portal/API_reference/GlideForm/concept/c_GlideFormAPI.html#r_GlideFormGetSectionNames
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-15-2022 02:58 AM
Hi Harish,
What do you mean by target record ? Is it the record created in target table ? If yes, you cannot use catalog ui policy . so use normal ui policy and use ui policy script to show/ hide section and making the field mandatory
The line of code which hides a section is :
g_form.setSectionDisplay('section_name', false);
You can use this with the conditions you want to put in.
If helps, Please mark correct and helpful
Regards!
Uma