Management service

Hi all,

I want to use management service api function setJobDueDate(jobid , date);

But , i am struggling to get the jobid of the timer so that i can pass it to the function.

Hi,

Using the management service, you can create and execute a Job Query.
Let’s assume your timer-event has the ID MyTimerEvent, then you can use the management service to get the Job Definition and its ID:

JobDefinition jobDefinition = managementService
        .createJobDefinitionQuery().activityIdIn("MyTimerEvent").singleResult();
String jobDefinitionId = jobDefinition.getId();

It may seem strange to provide the ID of the event as an activityId, but it works.

Then, you can use the job definition ID for a job query to get the corresponding jobs:

List<Job> jobsForTimerEvent = managementService
        .createJobQuery()
        .jobDefinitionId(jobDefinition.getId())
        .active()
        .list();

Depending on your use case, you can add additional parameters to your queries, such as the process instance ID.
I hope this helps.