Calling Script Include in Business rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2017 07:03 AM
Hi All,
I have a requirement of calling a script include from the business rule,
Let me explain the complete requirement
1) I have created a test variable in one of the catalog item
2) whenever the test variable is set to complete, Only then the business rule should trigger
3)I need to call the script include if the test variable is set to complete
Thanks in advance

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2017 07:07 AM
HI Mohammed,
Without any details, I can offer you only general constructs.
Use the business rule condition statement to check the variable value. Your business rule would use elements similar to the following:
Condition: current.variables.variable_name == 'true'
Script:
(function executeRule(current, previous /*null when async*/) {
// instantiate and call your script include here
var si = new MyScriptInclude();
si.myMethod();
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2017 07:11 AM
Thanks Tomasi,
WIll try and let you know..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2017 07:31 AM
It should run only on a particular catalog item,
For example : Test Catalog
Should i add the condition?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2017 07:35 AM
Yes, you need to add the condition to check for that particular catalog item. I'll assume your business rule is on the Requested Item (sc_req_item) table. In that case,
current.cat_item.name == 'Name of your catalog item'
needs to be added to the condition to prevent it from running on other catalog items.