You need to sign in to do that
Don't have an account?
MasahiroY
Rollup Summary in Lookup Relation
I'm working on "Rollup Summary in Lookup relation". It seems after-update and after-delete work fine, it rolls up child object fields to and updates fields in parent object safely.
Parent = Edition__c
Child = Booking__c
But after-insert or creating new records triggers the NullPointerException and CAN NOT INSERT UPDATE ACTIVATE ENTITY.
"Error Occurred: The flow tried to update these records: null.
This error occurred: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY: Booking2EditionTrigger: execution of AfterUpdate caused by: System.NullPointerException: Argument cannot be null. Trigger.Booking2EditionTrigger: line 38, column 1."
Trigger
https://gist.github.com/liuxiachanghong/7ac277f158f64ec54a3f4c3543a15832
Thanks for your advice!
Parent = Edition__c
Child = Booking__c
But after-insert or creating new records triggers the NullPointerException and CAN NOT INSERT UPDATE ACTIVATE ENTITY.
"Error Occurred: The flow tried to update these records: null.
This error occurred: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY: Booking2EditionTrigger: execution of AfterUpdate caused by: System.NullPointerException: Argument cannot be null. Trigger.Booking2EditionTrigger: line 38, column 1."
Trigger
https://gist.github.com/liuxiachanghong/7ac277f158f64ec54a3f4c3543a15832
Thanks for your advice!
To resolve the issue, I recommend doing a size check for relatedBookings before it is used in the for loop
for (Booking__c eachBooking : relatedBookings){
As per the documentation, The execution of a trigger will sometimes generate an error message, "execution of [EventName] caused by: System.NullPointerException: Attempt to de-reference a null object: Trigger.[TriggerName]: line [XX], column [XX]"
This error is caused by a line of code that is trying to use an object that has not been instantiated, or an object's attribute that has not been initialized.
This is similar to argument cannot be null
https://help.salesforce.com/articleView?id=000327918&type=1&mode=1
You can also consider using Safe Navigator Operator
Safe Navigator Operator