Script include
Script include
Script Include
var AssetValidation = Class.create();
AssetValidation.prototype =
Object.extendsObject(global.AbstractAjaxProcessor, {
checkDuplicate: function() {
// Retrieve parameters passed from the client script
var fieldValue =
this.getParameter("sysparm_field_value");
if (gr.next()) {
return 'true'; // Record found
}
return 'false'; // No record found
},
type: 'AssetValidation'
});
Client Script:-
function onChange(control, oldValue,
newValue, isLoading, isTemplate) {
if (isLoading || newValue === ''||
newValue === oldValue) {
return;
}
//passes the script include name
var ga = new
GlideAjax('AssetValidation');
//Call the server side function
ga.addParam('sysparm_name',
'checkDuplicate');
//Passes the new field value (newValue) to
the server for validation
ga.addParam('sysparm_field_value',newVa
lue);
ga.getXMLAnswer(function(response) {
Thank you