You need to sign in to do that
Don't have an account?
Tad Matjusenko
Trigger to display most recent value from child records on parent record
Hi All,
We have object Fee which is child of the Account object. Fee is calculated once a year per account and we need to display most recent Fee on Account level.
Current fee is stored in Fee_Amount__c field and ti is a formula field which holds currence data type.
We need to display Fee_Amount__c value on Account level from most recently created Fee record.
Thank you in advance
We have object Fee which is child of the Account object. Fee is calculated once a year per account and we need to display most recent Fee on Account level.
Current fee is stored in Fee_Amount__c field and ti is a formula field which holds currence data type.
We need to display Fee_Amount__c value on Account level from most recently created Fee record.
Thank you in advance
Hi Tad,
Try this:
Note: I have written in notepad may you will get some syntactical errors.
Hope this helps you!
If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others.
Thanks
Varaprasad
@For SFDC Support: varaprasad4sfdc@gmail.com
Salesforce latest interview questions :
https://www.youtube.com/channel/UCOcam_Hb4KjeBdYJlJWV_ZA?sub_confirmation=1
Thank you for your answer, I re-wrote code and ant line 24 it says missing " at 'update' and I can't understand what is wrong, hopefully that is the only reason and I will be able to test once this error will be gone.
Thank you
If Fee record is created under an account in a year and added the amount then we can write a trigger in fee object and update the amount to the related account's Fee_Amount__c field .
I think u can change the Fee_Amount__c field type to Currency instaed formula .
Try with below trigger ,this will work only if your scenario to create only one Fee record per year after create it will update in account .
Let me know if it helps or you need any help !!!
Thanks
Manoj
update mapAcc.values();
}
Code does not fail, but it doesn't work, it populates Current_Fee__c field, but when I add another Signatory_Fee__c it won't update Current_Fee__c field on Account.
I will try to explain what code should do step by step, hopefully that will help:
1) When new Signatory_Fee__c record is created code must check if current record is most recent associated with current account, by CreatedDate
2) When it is identified that this Signatory_Fee__c record is most recent for this Account, then Current_Fee__c field on Account object must be populated with Fee_Amount__c field value from Signatory_Fee__c object
Thank you for all your help