You need to sign in to do that
Don't have an account?
After delete getting error???
I am getting the following error:
There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Apex trigger Last_CBM_F2F_Meeting_trg caused an unexpected exception, contact your administrator: Last_CBM_F2F_Meeting_trg: execution of AfterDelete caused by: System.NullPointerException: Attempt to de-reference a null object: Trigger.Last_CBM_F2F_Meeting_trg: line 5, column 1".
On this line:
Set<Id> relatedIds = new Set<Id>(); for (Task indivTask : Trigger.new) { if (indivTask.WhatId != null) relatedIds.add(indivTask.WhatId); }
Any help would be appreciated... Basically if a user deletes the task the Last date field should become null on account.
Thanks
hi
If you are getting a null pointer exception there will be two reasons.
one is there is no values at all to delete or edit,
the path or the approach to meet that value is wrong.
check thorughly with this
indivTask.WhatId
I do not think it should matter no...Here is all of my code: the update to account works but when I tried to delete the task and get the most latest task that completes the requirement it errors out meaning after i placed in After Delete in there..
place a system.debug before delete operation takes place and check in the debug logs are you getting the record id which you are trying to delete
Actually I wrote another trigger that would update the field to null or the latest date of the task when a Open task is deleted. It worked.
Cool
thanks for everything
Z