You need to sign in to do that
Don't have an account?
Terri Henry
help with a simple trigger
Hi All,
I need to create a trigger that "rolls up" the field Amount__c from a custom object Sessions to a custom object called Session_Invoice to a field called Invoice_Amount - I can't use a rollup summary field unfortunately as it's just a lookup relationship.
I'm quite new to Salesforce and Coding, so struggling where to start!
Any help would be much appreciated
I need to create a trigger that "rolls up" the field Amount__c from a custom object Sessions to a custom object called Session_Invoice to a field called Invoice_Amount - I can't use a rollup summary field unfortunately as it's just a lookup relationship.
I'm quite new to Salesforce and Coding, so struggling where to start!
Any help would be much appreciated
trigger SessionAmountRollup on Session__c (after insert, after update, after delete, after undelete) { }
Not sure yet how to handle after delete and after un-delete - trigger.new isn't populated on after delete - so you'd need to use trigger.oldmap.values() - but I think that gives you a good idea of how to do it. That should "re-calculate" the entire roll-up after any Session changes.
All Answers
If you still want trigger code - let me know.
Thanks for your responses - I have actually checked out Rollup Helper - which looks great, however the free version does not roll up in realtime (minimum refresh time is one hour).
Haven't been able to get sign off on the subscription $2k+ p/a
Not sure yet how to handle after delete and after un-delete - trigger.new isn't populated on after delete - so you'd need to use trigger.oldmap.values() - but I think that gives you a good idea of how to do it. That should "re-calculate" the entire roll-up after any Session changes.