Retrieving Apex Batch Job Information
This global method retrieved the information of the asynchronous apex job running in the backend for a business object.
You can retrieve current information of the following apex jobs:
- Create and activate Agreement
- Clone proposal and agreement
- Finalize proposal and agreement
- Accept proposal
- Create and accept Order
- Asynchronous cart pricing
API |
Signature |
---|---|
getBatchJobInfoForContext |
static Apttus_Config2.CPQStruct.JobInfo getBatchJobInfoForContext(Id ctxObjectId) |
Request Parameter |
|||
---|---|---|---|
Name |
Type |
Required? |
Description |
ctxObjectId | ID |
Yes |
The Id of the business object like proposal or agreement. |
Response Data Object -Apttus_Config2.CPQStruct.JobInfo |
||
---|---|---|
Field |
Type |
Description |
ChildJobs | List |
The child apex jobs that are associated the original apex jobs. |
CompletedDate | Datetime |
The date and time when the original or child of the apex job was completed. |
ExtendedStatus | String |
The messages of errors encountered during apex job runtime. |
JobId | Id |
The apex job Id |
JobName | String |
The functional and apex job name in the following format: <Function name>:<apex job name> |
JobType | String |
The type of the apex job. For example, queueable and batchable. |
ParentJobId | Id |
The Id of the given apex job's parent |
PercentComplete | Integer |
The percentage of completion of the apex job at the time when global method was invoked. |
Status | String |
The status of the parent apex job. The following are the possible values:
|
SubmittedDate | Datetime |
The date and time when the apex job was submitted. |
Code Sample
The above global method can be used in API polling in a specific interval to retrieve the current status of the apex jobs running in the backend. For example, you are building a custom Lightning Web Component to show the live progress bar with the percentage of completion and status of the job in the proposal object. The Below apex controller calls the global method and returns the percentage of completion and the status to the UI controller to handle.