- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-10-2023 04:04 AM
Hi,
We have a catalog item "Access" and it has a variable called 'Category' select box type. It has couple of choices instead of 'None' we want to use "--Please select a value--" option. I have created onload script and it is working in native view but portal not setting the value.Please check attached screenshots.
Onload Native view
onload service portal - by default it is setting to first choice option instead of '"--Please select a value--"
can anyone suggest me to resolve this issue?
Thanks,
Rakesh T
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-10-2023 05:08 AM
Hi @Rakesh50
Try this code
g_form.removeOption('category','');
g_form.addOption('category','', '--Please select a value--', 0); //no spaces for second paramter
g_form.setMandatory('category', true);
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-10-2023 04:20 AM
Is the UI type of your on Load client script set to "All" , if not it will not work on portal.
Please mark the answer correct/helpful accordingly.
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-10-2023 04:23 AM
Hi @RaghavSh ,
UI type already set to all and applies to requested items also true
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-10-2023 04:31 AM
Hi @Rakesh50
Can you please share the onload client script you configured.
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-10-2023 04:32 AM
Hi @Voona Rohila ,
Please check the below code
g_form.addOption('category', '','--Please select a value--',0);
g_form.setValue('category','');
g_form.setMandatory('category', true);