Calling the ajax function from business rule

uma17
Tera Guru

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

15 REPLIES 15

Shishir Srivast
Mega Sage

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.


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"


};


Hi uma,



Instead of...



var sicall = new hr_CaseAjax_amit();



do...



var sicall = new hr_CaseAjax_amit;



Thanks,


Berny


The rest looks good! I hope this helps


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