Can we call a same Script Include at both Server Side and Client side?

Sid_Takali
Kilo Patron
Kilo Patron

Hi all, 

I want to understand what should I need to do to call a same Script Include at both Server Side and Client side?

1 ACCEPTED SOLUTION

DrewW
Mega Sage
Mega Sage

You check the box "Client callable" on the script include and then you do something like the below.  It will allow you to use the same method in both places.

var testUtil = Class.create();
testUtil.prototype =  Object.extendsObject(AbstractAjaxProcessor, {
	
	getSpendCategory: function(SOMEPARM) {
		var varValueToUse = "";
		if(SOMEPARM)
			varValueToUse = SOMEPARM;
		else
			varValueToUse = this.getParameter("sysparm_SOMEPARM");
		if(!varValueToUse)
			return "";

		//Do your work here and return a value.

	},
	
    type: 'testUtil'
});

 

View solution in original post

1 REPLY 1

DrewW
Mega Sage
Mega Sage

You check the box "Client callable" on the script include and then you do something like the below.  It will allow you to use the same method in both places.

var testUtil = Class.create();
testUtil.prototype =  Object.extendsObject(AbstractAjaxProcessor, {
	
	getSpendCategory: function(SOMEPARM) {
		var varValueToUse = "";
		if(SOMEPARM)
			varValueToUse = SOMEPARM;
		else
			varValueToUse = this.getParameter("sysparm_SOMEPARM");
		if(!varValueToUse)
			return "";

		//Do your work here and return a value.

	},
	
    type: 'testUtil'
});