how to call multiple function in script include

Supriya Mane
Tera Contributor

how to write multiple function in script include and how we can call that function in scripted rest api

3 REPLIES 3

Anurag Tripathi
Mega Patron
Mega Patron

Assuming you are creating the script include, or can modify it, You can call one function, and let that function call another function internally. That way in one request and one response you will get all the data you need.

 

-Anurag

Shivam Techlene
Tera Guru

Hello @Supriya Mane ,

 

You can write any number of functions in your script include using function object.

 

Example:

 

Script Include:

var ScriptIncludeName = new Class.create();

ScriptIncludeName.prototype = {

initialize: function() {

},

function1: function() { //function1 definition

...code

},

 

function2: function() { //function2 definition

....code

},

 

type: 'ScriptIncludeName'

};

 

Then you can call these functions in your scripted Rest API by creating object of your script include class.

 

Scripted Rest API:

 

var obj = new ScriptIncludeName(); //creating object of ScriptIncludeName class

obj.function1(); //calling function1 using object

obj.function2(); //calling function2 using object

 

Just Apply the modifications as per your naming conventions and put it in your code.

 

 

Thanks & Regards,
Shivam Jaiswal

Hi @Supriya Mane ,

 

Did you get a chance to try this one?

Please mark the answer helpful & correct if it helps to resolve your requirement.

 

Thanks & Regards,
Shivam Jaiswal