0

Want to freeze one user account, before want to know how many jobs(process builder, workflow, batch job everything) are running by the user?

Any type of suggestion or SOQL statement will be helpful.

1

I would have to ask why you needed to know this?

In order to gracefully allow pending processing to be performed you should first freeze the account and only later deactivate it (freezing simply disallows login but existing jobs for the user can continue to run).

Note, however, that there is one set of processes you definitely need to look for; scheduled jobs owned by that user (CronTrigger records). You must deal with moving these to a different user as needed. This includes scheduled batches, scheduled apex and scheduled flows, as can be determined using the CronJobDetail record associated with the CronTrigger record.

This is non-trivial, since you won't necessarily know the internal state for these jobs (e.g. the members of the Batchable that is scheduled) and cannot access it. Scheduled jobs will typically be easier to deal with since your app will usually only have a handful of such jobs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.