Calling the ajax function from business rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2017 08:32 PM
Hi All,
I have a Business Rule from which I am trying to call a function "ajaxFunction_getDocumentBody", but its not getting invoked.
I tired calling it it many ways but its not.
Can anyone please let me know how to invoke "ajaxFunction_getDocumentBody" from business rule.
Thanks,
Uma

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2017 08:57 PM
Hi Uma,
Can you please let us know the code, if possible, then it would be easy for us to verify if anything is wrong or missing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2017 09:48 PM
Hi All,
The code I have written is
Business Rule
(function executeRule(current, previous /*null when async*/) {
var sicall = new hr_CaseAjax_amit();
sicall.getDocumentBody();
})(current, previous);
Script Includes
var hr_CaseAjax_amit = Class.create();
hr_CaseAjax_amit.prototype = {
initialize : function() {
},
getDocumentBody : function() {
gs.log("Good Morning : Calling you");
var h = "Hello";
return h;
},
type : "hr_CaseAjax_amit"
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2017 09:51 PM
Hi uma,
Instead of...
var sicall = new hr_CaseAjax_amit();
do...
var sicall = new hr_CaseAjax_amit;
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2017 09:51 PM
The rest looks good! I hope this helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2017 09:53 PM
You may want to check if this works using a background script and running the following code:
var sicall = new hr_CaseAjax_amit;
sicall.getDocumentBody();
Please let us know if this is helpful
Thanks,
Berny