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

Returns

After the apex action execution formula field recalculation is not triggered and thus formula fields should be recalculated by the apex class itself.