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?