- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2014 10:32 AM
I am playing around with a new True/False element on my Incident form, that simply asks the end user who is using the Incident form, "Has the location been verified?". I went to True/False, because this is the only way I could find to get a check box on the Incident form.
In brief, I want the end user to Check this True/False, thus making it True, when they have confirmed the customer's location. Because this True/False is a boolean, I have not seen an easy way to make it Mandatory (because what is mandatory in true and false?), so I was wondering if I could use a Client Script that checks if the value of this True/False to be True, and not False, when the page is saved/submitted etc? Any other good way to do this?
Much thanks.
Solved! Go to Solution.
- Labels:
-
User Interface (UI)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2014 01:36 AM
Hi Shane,
I have tried similar things and I always switched to a standard string field with Yes/no as a choice list. This way you can have the the default to 'nothing' and thus forcing the user to select either yes or no.
Regards,
Daniel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2014 02:54 PM
Hello all,
I have got this working, however I would like to add another condition to the If statement. I would like this condition to be the incident state, to check if the incident state is New. Only if the incident state is New, and the original condition is false, then this alert comes up and stops the page from submitting.
This is the code I have tried:
function onSubmit(){
var locVerified = g_form.getValue('u_confirm_location'); //this is your true/false field name
if(locVerified == 'false' && incident_state == "1")
{
alert('Please ensure to verify the location with the customer.');
return false; //if we return false, then the update/sumbission of the record will be aborted
}
}
What I added is the incident_state == "1" part, where 1 is the value for "New". I believe this is out of the box with ServiceNow. However this is not working, it is simply not allowing Submit to be clicked at all, no alert box at all is coming up. Any idea what I can change to make this work as I mentioned above?
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2014 08:06 AM
Try:
if(locVerified == 'false' && g_form.getValue('incident_state') == "1")
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2014 09:50 AM
Thanks Ben! That did it!