Open intermx-reddysai opened 3 years ago
+1
+1
I believe that you can accomplish this by fact comparison and just provide the target value as dynamic fact at runtime or as a static fact on engine initialization.
Something along these lines. This doesn't address event message interpolation though as that's not currently supported.
const ptoRule = new Rule({
name: 'christmas-pto-rule',
conditions: {
all: [{
fact: 'account-information',
operator: 'equal',
value: {
fact: 'company'
},
path: '$.company'
}]
},
event: {
type: 'christmas-pto',
params: {
message: 'current employee taking christmas day off'
}
}
});
engine.addRule(ptoRule);
engine.run({
company: 'microsoft'
});
Example: