ProcessInstance
Get list of Processess for Object
SELECT Id,Status,SubmittedById,TargetObjectId FROM ProcessInstance where Status = 'Pending' and TargetObjectId = 'a1m14000002gvWG'
SELECT Id, CompletedDate, ElapsedTimeInDays, ElapsedTimeInHours, ElapsedTimeInMinutes, LastActorId, ProcessDefinitionId, Status, TargetObjectId FROM ProcessInstance WHERE id =:result.instanceId]
ProcessInstanceWorkItem
select Id from ProcessInstanceWorkitem where ProcessInstanceId = '04gW0000000X2Y1IAK'
SELECT Description, Id FROM ProcessDefinition
Scheduled Jobs
CronTrigger and CronJobDetail objects
SELECT Id, CronJobDetail.Name, NextFireTime, PreviousFireTime, State, StartTime, EndTime, CronExpression, TimeZoneSidKey, OwnerId, LastModifiedById, CreatedById, CreatedDate, TimesTriggered FROM CronTrigger order by CreatedDate desc
SELECT TimesTriggered, NextFireTime FROM CronTrigger WHERE Id = :jobID
SELECT TimesTriggered, NextFireTime FROM CronTrigger WHERE Id = :sc.getTriggerId()
SELECT Id, CronJobDetail.Id, CronJobDetail.Name, CronJobDetail.JobType FROM CronTrigger ORDER BY CreatedDate DESC LIMIT 1
To obtain the total count of all Apex scheduled jobs, excluding all other scheduled job types, perform the following query. Note the value '7' is specified for the job type, which corresponds to the scheduled Apex job type.
SELECT COUNT() FROM CronTrigger WHERE CronJobDetail.JobType = '7'
Comments
Post a Comment