Description
Recently, I faced an interesting situation in one of my Salesforce environments. A batch class that was scheduled to run daily was not being executed as expected. When I checked in Apex Jobs, the batch class was showing a status of "Queued", and I was left wondering if it was actually running in the backend or not.
Step 1: Checking the Batch Job in Apex Jobs
To verify the status of my batch, I used the following SOQL query:
SELECT ApexClassId,
ApexClass.Name,
Id,
JobItemsProcessed,
JobType,
Status,
NumberOfErrors,
MethodName,
CreatedDate,
CompletedDate
FROM AsyncApexJob
WHERE ApexClass.Name = 'Your_Batch_Class_Name'
This query gave me the details, but the status still showed as Queued.
Step 2: Why Does the Status Stay Queued?
Here’s the catch - by design, scheduled apex will always remain in the "Queued" status until the job has an end date.
- If your job is scheduled indefinitely, it will always stay in the Queued state because Salesforce treats it as continuously scheduled.
- To avoid confusion, it’s recommended to always provide both a Start Date and an End Date while scheduling your batch jobs.
Without the end date, you might feel like the job is stuck, when in fact it’s simply the way Salesforce handles indefinite schedules.
Step 3: How to Verify If the Batch is Actually Executing
If you want to confirm that your scheduled batch is actually running, use this SOQL on CronTrigger:
SELECT FIELDS(ALL)
FROM CronTrigger
WHERE CronJobDetail.Name = 'Your_Batch_Class_Name'
This query provides insights such as:
- The scheduled time of your batch job
- The end time for execution on that day
This way, you can be confident that your job is not really stuck but is being executed as per the defined schedule.
Key Takeaway
These issues may look simple but can easily eat up a whole day if you don’t know the underlying reason.
- Always provide Start Date and End Date when scheduling batches.
- Use CronTrigger SOQL to validate execution details instead of relying only on AsyncApexJob.
With this understanding, you’ll save yourself hours of debugging the next time you face a “Queued” batch job in Salesforce.
Learn Data Cloud with Real World Example


1 Comments
Validation Bypass to Automation Not Lower Normal User - Need help bypass locked order update (any order can update by automation where order is locked bypass validation)
ReplyDeleteAND( NOT(ISNEW()),
PRIORVALUE(Finance_Check_Point__c) = true ,
NOT(ISCHANGED (Status)), NOT(ISCHANGED(Is_Zoho_Estimate_Created__c)) ,
$
Profile.Name
!= 'Finance Ops',
$
Profile.Name
!= 'System Administrator'
)
bypass this validation for only and only for any automation running on order object || but when normal user try to update (lower user it must throw this validation)
Please help me to solve this
previously i have crated to checkbox false on is signal and one is process when the flow is going to update locked order am make turn on signal and in before trigger i capture the signal and make process true and signal false and after update trigger am try to make process false but unfortunately this is not updating it stuck at true ( i have create static variable to stop recursions )