I am struck with a nasty situation : I will try to explain this as clear as possible.
I have 2 fields
A & B
B = B + A
when I change A(input field) I want to include the formula's new value and divide the new value by another field
in short : C = A/ B(calculated using formula field)
I want my trigger to include the new value of the formula when i save the record :(!!! Its kind of a chicken and hen story
Until the formula is saved the trigger calculations are not accurate
Looking at this post the post says formula changes are accessible to trigger : Do Apex Triggers have access to formula fields?
Is the above statement true if so am i missing something? I tried to exclude the formula field from the soql but it errors out that soql was excluded (as per the post reference the field need not be included in the soql).
Code :
for(quote q:[select id,recordtype.id,formula__c from quote where ID IN: trigger_new]){
system.debug('##### new formula value'+ q.formula__c);
c_field = A_field / formula__c;( the formual val points to 700 while in the record it calculated the right value to be 400).
}
Debug Result :
$ 700