You need to sign in to do that
Don't have an account?
Lon Jones
Access Record Prior Value in Apex
I am trying to pass a prior value as a param to a flow that I need to call from apex because I need to cover the inability to deal with deleted records without apex triggers. Can someone lend guidance as to how to access a record's prior value? thanks
I need something like this (I know it's not that simple)
For (Animal_Location_History__c Animal : Trigger.Old) {
// Call the Flow
Map<String, Object> params2 = new Map<String, Object>();
params2.put('varInputAnimalLocation', Animal_Location_History__c.Animal_Location__c);
params2.put('varPriorLocation', PRIORVALUE(Animal_Location_History__c.Animal_Location__c));
params2.put('varInputAnimalLocation', Animal_Location_History__c.Location__r.Id);
Flow.Interview.Update_Location_Inventory Update_Location_Inventory = new Flow.Interview.Update_Location_Inventory(params2);
Update_Location_Inventory.start();
// System.debug('Animal Location ' + Animal_Location_History__c.Animal_Location__c );
}
I need something like this (I know it's not that simple)
For (Animal_Location_History__c Animal : Trigger.Old) {
// Call the Flow
Map<String, Object> params2 = new Map<String, Object>();
params2.put('varInputAnimalLocation', Animal_Location_History__c.Animal_Location__c);
params2.put('varPriorLocation', PRIORVALUE(Animal_Location_History__c.Animal_Location__c));
params2.put('varInputAnimalLocation', Animal_Location_History__c.Location__r.Id);
Flow.Interview.Update_Location_Inventory Update_Location_Inventory = new Flow.Interview.Update_Location_Inventory(params2);
Update_Location_Inventory.start();
// System.debug('Animal Location ' + Animal_Location_History__c.Animal_Location__c );
}
Please try the below:
From Trigger.OldMap you can get the old value.
Thanks,
Maharajan.C