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

DomainProcessBinding__mdt.PreventRecursive__c is ignored. #89

Open
simon-nowak opened this issue Sep 19, 2023 · 1 comment
Open

DomainProcessBinding__mdt.PreventRecursive__c is ignored. #89

simon-nowak opened this issue Sep 19, 2023 · 1 comment
Assignees

Comments

@simon-nowak
Copy link

Describe the bug
During trigger execution, criteria/action can be executed several time whatever the value set in DomainProcessBinding__mdt.PreventRecursive__c

As a result this can lead to additional limits consumption.

To Reproduce

I think I managed to reproduce the issue in my repo with a unit test:
master...simon-nowak:at4dx:preventRecursive

Expected behavior
I think any developper would like to be able to prevent recursive execution during a transaction. Projects like DLRS or flows can lead to recursive execution.

Version
Present in last version

I might have a few spare days this week and next week. If this is a feature that need to be implemented inside the framework, I would like to try to fix it.

I'm not 100% sure how this should work:

  • Can "prevent recursive" be applied for to criteria AND actions ?
  • If "prevent recursive" is applied what is the expected behaviour? Should it filter by "records" already evaluated, or be less precise and only focus on being called once?
@ImJohnMDaniel
Copy link
Collaborator

G'day @simon-nowak

Thanks for reaching out. My apologies for the delay in responding. It has been a busy few weeks.

The whole concept of preventing recursion was a feature that never got implemented. Yes, there was a field put into the DomainProcessBinding__mdt.object-meta.xml object but the feature was never finished. So if you would like to collaborate on it, that would be awesome.

Regarding your question of exactly how this would work, I have not completely figured this out yet. The entire domain process is represented as the collection of criteria and action CMDT records that have the same "whole number portion" of the OrderOfExecution__c field.

My first thought would be to prevent the entire domain process from executing recursively while other domain processes with a different OrderOfExecution__c would be unaffected. One thought would be to go through the first execution of the domain process and if any of the CMDT records related to the Domain Process have the PreventRecursive__c field checked on any of the associated criteria or action records, then there would be a internal marker setup in the DomainProcessCoordinator for this domain process number and any further executions of that domain process would be short circuited as each criteria and action is evaluated.

Think about it and let me know your thoughts when you can.

@stohn777 and @ClayChipps -- you two might have some interest in this effort as well. Please think about it and let me know your thoughts.

Thanks to all.

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

2 participants