ATS v2: 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 of Application_V2__c records with the fields that are displayed in the table.
    • When called from Apply To Other Job action, application records do not have Id yet but can be identified by TR1__Applicant__c and TR1__Job__c fields.

Returns

  • ATSActionBase.ATSActionResponse object, 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.
    • showToast: If set to true, the toast message will be displayed with message and messageType.
      • If not provided, ATSSuccess/ATSError labels are used for the message and success/error message type based on the isSuccess value.
    • message: Message text for the toast message
    • messageType: 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.