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

Action Workflow and global params do not work together #626

Open
rklec opened this issue Aug 15, 2024 · 0 comments
Open

Action Workflow and global params do not work together #626

rklec opened this issue Aug 15, 2024 · 0 comments

Comments

@rklec
Copy link

rklec commented Aug 15, 2024

STR

Let's say you have this action workflow:

{
  "$schema": "https://raw.githubusercontent.com/microsoft/RulesEngine/main/schema/workflow-schema.json",
  "WorkflowName": "MailEvaluationWorkflow",
  "GlobalParams": [
    {
      "Name": "myFavouriteThing",
      "Expression": "1"
    }
  ],
  // some action workflow rules here

What happens

This will always fail, if you have at least two rules, with an exception like this:

Exception: Error while executing rule : SecondRuleName - An item with the same key has already been added. Key: myFavouriteThing, ActionResult.Output: null

What should happen

IMHO this makes GlobalParams absolutely useless, as you cannot use them. It should just inject them once

In a basic workflow this works fine, so this only affects the action workflow.

More information

I have found #259, which seems to be about the same issue(?), where filtering etc. was introduced.
However, IMHO, this is still not a good way to handle it, is it?

Because come on, what use case does GlobalParams even have then? You cannot use them in any way if you have two rules, unless you do some filtering, which really is kinda silly to then always filter, is it?

Workaround

Apparently just define all global params as "local params" in your first rule, which is passed to all others unless you filter.
This kinda makes them "global" IMHO and is not a good naming and for me at least was totally confusing. And I had to read and understand the issue here first to get why this happens.

System

RulesEngine v5.0.3

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

No branches or pull requests

1 participant