Accessing the retry attempt for a failedJobRetryTimeCycle config during execution

Hello my friend! Welcome to community \o :smiley:

This script that I’m sending below can be used in an execution listner, or in a script task, or even directly in your project’s code (with a few modifications):

var retriesNumber = execution.getProcessEngineServices().getManagementService()
         .createJobQuery()
         .activityId(execution.getCurrentActivityId())
         .singleResult()
        .getRetries();

Although you can execute the necessary logic, I believe you will not be able to ā€œprintā€ the amount of retry in a process variable, for example, because this functionality has been buggy since 2018, I think from what I’ve heard.

In this post below, in the last comment, I talked a little about this subject.

But if you just need to run some logic like you mentioned it will work!

I hope this helps!

William Robert Alves

1 Like