client script, show/hide section

Ak_12
Tera Contributor

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  

8 REPLIES 8

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.

Ankur Bawiskar
Tera Patron
Tera Patron

@Ak_12 

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Basheer
Mega Sage

Hi @Ak_12 ,

You need to use g_form.setSectionDisplay('desktop', true); as suggested by @Anubhav24  and @Ankur Bawiskar 

 

Please hit like button if my suggestion has helped you in any way.
Please mark correct if my response has solved your query.

Cheers,
Mohammed Basheer Ahmed.

Ak_12
Tera Contributor

section is visible in default view and category dropdown as none so its not working with none