Skip to content

Instantly share code, notes, and snippets.

@fdn
Last active May 11, 2016 19:38
Show Gist options
  • Save fdn/16d3612348fafe03dc1d646e6d30caab to your computer and use it in GitHub Desktop.
Save fdn/16d3612348fafe03dc1d646e6d30caab to your computer and use it in GitHub Desktop.
K16 Mobile Lab Snippets
function onSubmit() {
// we did some validation?
if (isValidated) {
console.log('Form checks out!');
}
return true;
}
function onSubmit() {
// store a custom value to determine
// if we passed validation
if (g_form.isCustomValidated === true) {
console.log('Custom validation for the form passed!');
return true;
}
var gr = new GlideRecord('incident');
gr.addQuery('active', true);
// save the action name
var actionName = g_form.getActionName();
gr.query(function() {
console.log('GlideRecord rows: ' + gr.getRowCount());
// we have GlideRecord results here
// but we'll resubmit with our
// custom validation flag set
g_form.isCustomValidated = true;
// resubmit with the previous action name
g_form.submit(actionName);
});
console.log('Halting submit -- loading data...');
return false;
}
function onSubmit() {
// we did some validation!
var isValidated = true;
if (isValidated) {
console.log('Form checks out!');
}
return true;
}
current.setValue('state', 2);
current.update();
var gr = new GlideRecord('incident');
gr.addQuery('category', 'hardware');
// create a desktop URL
var url = 'incident_list.do?sysparm_query=';
url += gr.getEncodedQuery();
action.setRedirectURL(url);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment