Onsubmit script for variable set in catalog client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2022 10:55 PM
hi
Can anyone help me with the sample script of onSubmit for variableset's variable. I just want to show one alert by using the script.
Any help would be appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2022 11:17 PM
Hi @SK36
You can simply create catalog client script as below:- Select proper Variable set, UI type and applies.
Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2022 11:31 PM
Hi thanks for the solution. but my question is, variable set has a variable and it has true or false value. based on true or false value , I need to put alert.
how to do that?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2022 11:40 PM
Hi,
You can try below script:
if(g_form.getValue("your_variable_name") == "true") //put your variable name here
alert("Put your alert content here"); // Alert that you want to pop when value returned is true
else
alert("Put your alert content here"); // Alert that you want to pop when value returned is false
I hope this helps
Regards,
Kamlesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2022 11:43 PM
Hi @SK36
You can writedown as below :-
function onSubmit() {
if(g_form.getValue('variable_backend_name')=='true'){
alert('if True');
}else
alert('If False");
}