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

EvaluateRuleAction and GlobalParams exist together, error building RuleParameters. #259

Closed
RockTolo opened this issue Oct 20, 2021 · 2 comments · Fixed by #282
Closed

EvaluateRuleAction and GlobalParams exist together, error building RuleParameters. #259

RockTolo opened this issue Oct 20, 2021 · 2 comments · Fixed by #282
Labels
bug Something isn't working

Comments

@RockTolo
Copy link

var workflow = new Workflow {
    WorkflowName = "EvaluateRuleActionTest",
    GlobalParams = new ScopedParam[] {
        new ScopedParam {
            Name = "TotalAmount",
            Expression = "input1+input2",
        },
        new ScopedParam {
            Name = "OrderCount",
            Expression = "1+1",
        }
    },
    Rules = new Rule[] {
        new Rule {
            RuleName = "TotalAmount5W",
            Expression = "TotalAmount >= 50000",
            Actions = new RuleActions {
                OnSuccess = new ActionInfo {
                    Name = "OutputExpression",
                    Context = new Dictionary<string, object>
                    {
                        { "expression", "TotalAmount" }
                    }
                }
            }
        },
        new Rule {
            RuleName = "TotalAmount10W",
            Expression = "TotalAmount >= 100000",
            Actions = new RuleActions {
                OnSuccess = new ActionInfo {
                    Name = "EvaluateRule",
                    Context = new Dictionary<string, object>
                    {
                        { "workflowName", "EvaluateRuleActionTest" },
                        { "ruleName", "TotalAmount10W" }
                    }
                }
            }
        }
    }
};

image

ExceptionMessage: The identifier 'TotalAmount' was defined more than once

@abbasc52 abbasc52 added the bug Something isn't working label Oct 21, 2021
@abbasc52
Copy link
Contributor

Currently in EvaluateRule we pass all the inputs and global/local params of the rule. Since you are calling rule in same workflow, it is leading to conflicts.

Maybe we should allow consumers to pass what inputs should be forwarded to the EvaluateRule.

@RockTolo I would like to know your opinion on this and feel free to provide any other suggestion you may have

@RockTolo
Copy link
Author

@abbasc52 Just running a test. don't have any good ideas, sometimes defined workflow may have this scenario

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants