SFDC Stop - Always the latest about Salesforce


Full Tutorial Series with videos, free apps, live sessions, salesforce consulting and much more.


Telegram logo   Join our Telegram Channel

Sunday 4 July 2021

Scheduled Jobs Custom LWC Component

Hello Trailblazers,

Today I am going to share a custom component developed in lwc which can be used to filter out scheduled jobs related to a particular user. This is the first guest post on SFDC Stop. Let's see what the author has to say about this component in his own words:

User related schedule jobs

Use Case

Sometimes we need to know about any user's scheduled or apex jobs. I don’t get any standard view in salesforce to list all jobs, apart from navigating to setup which needs View Setup and Configuration permission and exposes the user to much more details except just viewing or interacting with scheduled jobs. This Apex Jobs section display the list of jobs either schedule or completed jobs but does not provide everything with details.

What are Scheduled Jobs?

Schedule jobs includes scheduled batches, scheduled apex and scheduled flows in salesforce. To query a schedule job we need to query two objects: CronTrigger and CronJobDetail. CronTrigger contains information for a scheduled job. CronJobDetail contains details about the associated scheduled job, such as the job’s name and type.

To know the status of the job we can write a SOQL on CronTrigger object. Use CronJobDetail relationship to get the job’s name and type as given below:

AsyncApexJob represents an individual apex sharing recalculation job, a batch apex job, a method with the future annotation, or a job that implements Queueable. Use this object to query apex batch jobs in your organization. Below SOQL query can be used to get the status of ApexJob

By applying those above SOQL I have build a component which can help to view all jobs related to a particular user.


This post was contributed by Shamim Siddiquee. You can connect with him on linkedin here: https://www.linkedin.com/in/shamim-siddiquee

Happy Trailblazing..!!

No comments:

Post a Comment