- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2025 12:53 AM
Can some one please let me know, How we can call a Script include via a Business rule. Example I have an existing client callable script include which returns true/false as the output i need to use the same in the Business rule for me to set up an error message.
Example:
I am currently using it like this:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2025 10:30 AM
@Saurabh Singh5 Please see below the format/syntax to call a script include from BR.
// Instantiate the Script Include
var scriptInclude = new ScriptIncludeName(); // Replace with the name of your Script Include
// Call the function and capture the return value
var result = scriptInclude.functionName(); // Replace with the name of your function
// Use the result in your Business Rule logic
if (result) {
gs.addErrorMessage("Your error message here"); // Set an error message if the result is true
} else {
// Proceed with other logic if the result is false
}
Mark my response as helpful if it resolves your doubt let me know if you are facing any issue.
Thanks,
Mahesh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2025 12:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2025 10:24 AM
Hi @Saurabh Singh5 ,
Please try using below format
var func=new ScriptIncludeName().functionName();
Please mark my solution as accepted and give thumbs up, if it helps you.
Regards,
Satya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2025 10:30 AM
@Saurabh Singh5 Please see below the format/syntax to call a script include from BR.
// Instantiate the Script Include
var scriptInclude = new ScriptIncludeName(); // Replace with the name of your Script Include
// Call the function and capture the return value
var result = scriptInclude.functionName(); // Replace with the name of your function
// Use the result in your Business Rule logic
if (result) {
gs.addErrorMessage("Your error message here"); // Set an error message if the result is true
} else {
// Proceed with other logic if the result is false
}
Mark my response as helpful if it resolves your doubt let me know if you are facing any issue.
Thanks,
Mahesh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2025 10:38 AM
Script Include:
var MyScriptInclude = Class.create();
MyScriptInclude.prototype = {
initialize: function() {
},
myFunction: function(){
gs.info('Testing');
},
type: 'MyScriptInclude'
};
BR:
new MyScriptInclude().myFunction();
If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.
Regards,
Sharanjeet Singh