: Admin: Configure Custom Action Apex Development Guide Actions On Mass Offer Grid View
In order to be executed, the Apex class must extend the ATSActionBase class and override the execute method:
Copy
public with sharing class ATSActionTest extends ATSActionBase {
public override ATSActionBase.ATSActionResponse execute(List<SObject> records) {
List<Application_V2__c> apps = (List<Application_V2__c>) records;
for (Application_V2__c record : apps) {
record.Salary_Offered__c += 100;
record.Candidate_Summary__c = 'test';
}
// update apps;
// apps = [SELECT Id, Salary_Offered__c, Candidate_Summary__c, TR1__Email__c FROM Application_V2__c WHERE Id IN :apps];
ATSActionBase.ATSActionResponse response = new ATSActionBase.ATSActionResponse();
response.records = apps;
response.isSuccess = true;
response.showToast = true;
response.message = '1 of 2 records has been recalculated';
response.messageType = 'warning';
return response;
}
}
Parameters
List<SObject>: Contains the list ofApplication_V2__crecords with the fields that are displayed in the table.- When called from
Apply To Other Jobaction, application records do not have Id yet but can be identified by TR1__Applicant__c and TR1__Job__c fields.
- When called from
Returns
ATSActionBase.ATSActionResponseobject, where:records: List of updated SObject records, Application_V2__c in case of Mass Offer - Grid.- Field values from these records will be populated into the table.
isSuccess: Indicates if the operation is successful.- If set to
false, the table is not being updated.
- If set to
showToast: If set totrue, the toast message will be displayed with message and messageType.- If not provided,
ATSSuccess/ATSErrorlabels are used for the message and success/error message type based on the isSuccess value.
- If not provided,
message: Message text for the toast messagemessageType: Type of the toast message.- Supports following values: success, error, info, warning
After the apex action execution formula field recalculation is not triggered and thus formula fields should be recalculated by the apex class itself.
Was this helpful?