How can modify the fact through a callback

112 views
Skip to first unread message

Brian Thibault

unread,
Dec 13, 2013, 2:55:09 PM12/13/13
to no...@googlegroups.com
flow.rule("RULE", criteriaArray,
      function(facts) {
        var _self = this; 
        // execute rule logic 
        ruleAction.run(facts.p, rg.then.params, function(response) {
            facts.p = response; 
            console.log(facts.p); // works correctly 
             _self.modify(facts.p);
        });  
  });

Basically trying to modify the fact through an asynchronous function, then on the callback alert the engine that the fact has been modified. 

However, I get the exception

Error: the fact to modify does not exist    at declare.instance.modifyFact (/Users/bthibault/Development/clarastream-rules-engine/node_modules/nools/lib/workingMemory.js:65:19)


What can I do to solve this? 

Douglas Martin

unread,
Dec 13, 2013, 4:32:09 PM12/13/13
to no...@googlegroups.com
Ahh, this looks like a bug can you open an issue against the repo and maybe include an example that can reproduce this error?

-Doug

Douglas Martin

unread,
Dec 13, 2013, 5:21:17 PM12/13/13
to no...@googlegroups.com
Here is the link to the created issue for anyone else that runs into the same issue. https://github.com/C2FO/nools/issues/94
Reply all
Reply to author
Forward
0 new messages