Last active
May 11, 2016 19:38
-
-
Save fdn/16d3612348fafe03dc1d646e6d30caab to your computer and use it in GitHub Desktop.
K16 Mobile Lab Snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function onSubmit() { | |
// we did some validation? | |
if (isValidated) { | |
console.log('Form checks out!'); | |
} | |
return true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function onSubmit() { | |
// we did some validation! | |
var isValidated = true; | |
if (isValidated) { | |
console.log('Form checks out!'); | |
} | |
return true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
current.setValue('state', 2); | |
current.update(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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