- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2017 12:01 PM
Hello all,
We have a form where its required for the user to have a certification completed. I added a Yes/No question ask whether they have completed this certification.
I want to see if there is a way to restrict submission of the request if they select "No" for this specific question. Any advice or know if this is even possible?
*Currently I have an If statement in the workflow, where if they answer "No" it ends the request. This isn't so great because the user would have to input all their information and then realize that nothing was recorded.
Thanks in advance!
-Grace
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2017 12:25 PM
Hi Grace,
Create an Onsubmit client script to check the value as "Yes" or 'No"
function onSubmit()
{
var trainingcompleted = g_form.getValue('Variable_name');
If(trainingcompleted == 'No')
{
alert("Please complete the certificate training");
return false;
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2017 12:04 PM
Grace,
You can write an on submission client script saying where:
If(field_name == false)
{
return false;
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2017 12:06 PM
Hi Grace,
You can have an Onsubmit client script written to validate each field & its option selected. If any of which has No selected you can use return false; to abort the submission & even an alert can be used to make user aware of the same.
Links: function onSubmit - Client Script Help Client Scripts - ServiceNow Wiki would help.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2017 12:25 PM
Hi Grace,
Create an Onsubmit client script to check the value as "Yes" or 'No"
function onSubmit()
{
var trainingcompleted = g_form.getValue('Variable_name');
If(trainingcompleted == 'No')
{
alert("Please complete the certificate training");
return false;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2017 02:56 PM
Thank you Vinoth, this is what I was looking for!