logo

NJP

How to Extend the Script Include With Your Custom Made Script Include?

Import · Aug 23, 2019 · article

How to Extend the Script Include With Your Custom Made Script Include?

Script Include 1 : Client callable

var SC_Assignment3_userinfo = Class.create();SC_Assignment3_userinfo.prototype =Object.extendsObject(AbstractAjaxProcessor, {user_info2:function(){return 'Inherited SuccessFully';},type: 'SC_Assignment3_userinfo'

});

============================================================================================

Script Include 2 : Client callable

var Inheritance_in_script_include = Class.create();Inheritance_in_script_include.prototype =Object.extendsObject(SC_Assignment3_userinfo, { //To Extend the another Script Include just remove the 'AbstractAjaxProcessor', and add Object of 'Script Include 1', like 'SC_Assignment3_userinfo'.inher:function(){var obj = this.user_info2(); //SC_Assignment3_userinfo,return obj;},type: 'Inheritance_in_script_include'});

===========================================================================================

Catlog Client Script to Call Script Include 2

OnChange of field : caller_id

function onChange(control, oldValue, newValue, isLoading, isTemplate) {if (isLoading || newValue === '') {return;}var ga = new GlideAjax('global.Inheritance_in_script_include');//Contains Script Include Namega.addParam('sysparm_name','inher');//This contains the function namega.getXML(HelloWorldParse);function HelloWorldParse(response) {var answer = response.responseXML.documentElement.getAttribute("answer");alert(answer);}

}

Labels:

image

View original source

https://www.servicenow.com/community/developer-articles/how-to-extend-the-script-include-with-your-custom-made-script/ta-p/2327334