You need to sign in to do that
Don't have an account?
Apex Trigger For Formula field Update
Hi,
I have two custom objects are there Like Expense__c and Policy__c. In Policy__c we have master data,like Fields Cashadvance__c,...etc.
Now i want to update Formula field in Expense__c and it has fetch data from policy__c when Designation__c in expense__c==Designation__c in policy__c. Please help me.
I have two custom objects are there Like Expense__c and Policy__c. In Policy__c we have master data,like Fields Cashadvance__c,...etc.
Now i want to update Formula field in Expense__c and it has fetch data from policy__c when Designation__c in expense__c==Designation__c in policy__c. Please help me.
You Ca't update formula filed becuase it is not Writable.
I believe the value of a formula field is not stored in the database, and does thus not change as you would expected.
The formula itself it stored, and when the field is queried, the formula is executed to calculate the formula value, which is then returned or displayed.
This is the data model I am understanding:
Two Objects:
Master Obj: Policy__c
Fields: Cashadvance__c, Designation__c
Detail Obj: Expense__c
Fields: Designation__c , Formula_Field__c
Now, your question is you want to have this Formula_Field__c calculated only when Designation__c on Expense__c and Designation__c on Policy__c is same. If this is the case then try doing the following:
Create a checkbox field named Custom_Checkbox__c on Expense__c report which would retrun TRUE or checked when Designation__c on Expense__c and Designation__c on Policy__c matches with each other. Otherwise FALSE means not checked.
Once this is done, write a formula for Formula_Field__c and have it only calculated if the Custom_Checkbox__c has value as TRUE or checked.
Hope this helps!