You need to sign in to do that
Don't have an account?
Anonymous Developer
Need Help on this Test Class
Here's my code:
Thanks.
public class AS_UnlockProgramEngagement { @InvocableMethod (label = 'Unlock Program Engagement Record' description = 'Unlock Program Engagement Object' category = 'Program Engagement') public static void unlockProgramEngagementRecord (){ List<pmdm__ProgramEngagement__c> brokerageList = [SELECT Id FROM pmdm__ProgramEngagement__c LIMIT 10]; // Get records to unlock List<pmdm__ProgramEngagement__c> lockList = new List <pmdm__ProgramEngagement__c>(); // Check locked records for(pmdm__ProgramEngagement__c b: brokerageList){ if(Approval.isLocked(b.id)){ lockList.add(b); } } if(!lockList.isEmpty()){ // Unlocks Record List<Approval.UnlockResult> unlockResultList = Approval.unlock(lockList, false); for(Approval.UnlockResult unlockResult : unlockResultList){ if(unlockResult.isSuccess()){ // Get processed Id of the record system.debug('Successfuly unlocked Brokerage Request' + unlockResult.getId()); } else { for(Database.Error err : unlockResult.getErrors()){ // Get all errors System.debug('The following error has occured.'); System.debug(err.getStatusCode() +' : ' + err.getMessage()); System.debug('Brokerage Request field that affected this error: ' +err.getFields()); // System.debug('Total Quotes Unlocked in the Execution : ' + unlockResultList.size()); } } } } } }
Thanks.
try with below code.
If this helps, Please mark it as best answer.
Thanks!!
All Answers
try with below code.
If this helps, Please mark it as best answer.
Thanks!!
Hello Ankaiah
there is an error in the code
Class.AS_UnlockProgramEngagementTest.AS_UnlockProgramTestMethod: line 14, column 1