client script, show/hide section
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2023 11:40 PM
On my customtable form i have field subcategory (choice), choices are desktop, laptop, tab, printers, mobile. and i have created sections for all that choices separately. so if i select desktop only desktop section should be visible, like this for every choice
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2023 05:36 AM
var printerValue = subcategoryValue == 'printer';
Should't be there a third equal to sign between subcategory and printer subcategoryValue === 'printer'; Try after updating your code and then let us know.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2023 12:40 AM
should be easy.
use this to show -> g_form.setSectionDisplay('desktop', true);
use this to hide -> g_form.setSectionDisplay('desktop', false);
please modify your script as per this and it will work
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2023 06:44 AM
Hi @Ak_12 ,
You need to use g_form.setSectionDisplay('desktop', true); as suggested by @Anubhav24 and @Ankur Bawiskar
Please mark correct if my response has solved your query.
Cheers,
Mohammed Basheer Ahmed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2023 11:27 PM
section is visible in default view and category dropdown as none so its not working with none