Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic values inside rules #67

Closed
ganeshcse2991 opened this issue Mar 16, 2018 · 1 comment
Closed

Dynamic values inside rules #67

ganeshcse2991 opened this issue Mar 16, 2018 · 1 comment
Labels

Comments

@ganeshcse2991
Copy link

ganeshcse2991 commented Mar 16, 2018

I am trying to do the following. Please let me know if its possible in any other way.

{
conditions:{
...
..
...
}
event: {
type: sendEmail,
params: {
from_email: $fact.from_email,
subject: "Test subject $fact.subject"
}

I want to place the values from the fact to the rules's event params dynamically.
I am ok with the solution having placeholders too.

Thanks in advance.

@CacheControl
Copy link
Owner

@ganeshcse2991 I would recommend simply storing the fact in a variable outside the engine, and reference it in the on(success) event. Another option is to call almanac. _getFact(factId). I would not recommend this approach as it's a private method of the library (denoted by the underscore), so it might be removed in future versions...but I mention it in case you don't like or can't do the first option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants