You need to sign in to do that
Don't have an account?
Kiril Vodenicharov 7
How to Map old and new values before and after update triggers on cirtain criteria
I want to update before and after a record when it have certain status criteria which is met. Lets say WHEN Quote have met: Merchant Approved status to create new Order.
public inherited sharing class CPQ_QuoteTriggerHandler extends Common_TriggerHandler implements Common_TriggerInterface { public void beforeUpdate(Map<Id, SObject> mapNewItems, Map<Id, SObject> mapOldItems) { // Call the trigger. } }
TriggerHelper
public static void merchantApproved(List<SBQQ__Quote__c> quoteList, Map<Id, SBQQ__Quote__c> oldMap) { Set<Id> quoteIds = new Set<Id>(); for(SBQQ__Quote__c q : quoteList) { quoteIds.add(q.SBQQ__Status__c); } oldMap = new Map<Id, SBQQ__Quote__c>([SELECT Id, SBQQ__Status__c FROM SBQQ__Quote__c WHERE Id IN :quoteIds]); for(SBQQ__Quote__c q : quoteList) { if(oldMap.get(q.Id).SBQQ__Status__c == q.SBQQ__Status__c && q.SBQQ__Status__c == 'Merchant Approved') { Order order = new Order ( AccountId = q.Id, Name = q.Name ); } } }
Didnot get your question . Is it you want to compare Old and new Values?