sfdc-trigger-framework icon indicating copy to clipboard operation
sfdc-trigger-framework copied to clipboard

getLoopCount() ?

Open Fosnez opened this issue 5 years ago • 3 comments

Is it by design, or just an oversight that there doesn't appear to be a way of seeing how many loops/recursions you are current in?

Would be useful to say "only run this on the outer most loop" etc.

Or have I missed the mark here?

Fosnez avatar Nov 05 '18 14:11 Fosnez

You seem to be correct in this observation. The easiest way I can see to check the loop count is by accessing the loopCountMap static variable (which is private now).

If it were public, you could get the count using:

TriggerHandler.loopCountMap.get('handlerName').getCount();

If you want to, you might want to submit this as a new feature. If not, I might add this feature to my fork of the repository later.

renatoliveira avatar Nov 05 '18 15:11 renatoliveira

I don’t see why this couldn’t be added. Happy to look at a PR On Mon, Nov 5, 2018 at 10:56 AM Renato Oliveira [email protected] wrote:

You seem to be correct in this observation. The easiest way I can see to check the loop count is by accessing the loopCountMap static variable (which is private now).

If it were public, you could get the count using:

TriggerHandler.loopCountMap.get('handlerName').getCount();

If you want to, you might want to submit this as a new feature. If not, I might add this feature to my fork of the repository later.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kevinohara80/sfdc-trigger-framework/issues/16#issuecomment-435927058, or mute the thread https://github.com/notifications/unsubscribe-auth/AAigQGxx5dGIupMy9w1RKFqkUXlChJUAks5usF-ZgaJpZM4YOm8u .

kevinohara80 avatar Nov 06 '18 10:11 kevinohara80

@kevinohara80 Please take a look at PR #13, thanks.

renatoliveira avatar Nov 06 '18 13:11 renatoliveira