how to call multiple function in script include
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2024 02:14 AM
how to write multiple function in script include and how we can call that function in scripted rest api
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2024 02:30 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2024 03:00 AM
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.
Shivam Jaiswal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2024 05:09 AM
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.
Shivam Jaiswal