My requirement is to insert the formula field value(Formula calculated by few other factors), in a different field on the same object. The below code is running in before update but i see many suggesting the update should be after as ,it is a formula field.
public static void fieldUpdate(List<Requested_Item__c> triggerNew, map<id, Requested_Item__c> oldMap){
for(Requested_Item__c newchange : triggerNew) {
if (oldMap.get(newchange.id).price_formula__c != newchange.price_formula__c && oldMap.get(newchange.id).vendor_unit_price__c != newchange.price_formula__c) {
newchange.vendor_unit_price__c = newchange.price_formula__c;
}
}