Skip to main content
Hi Team,

As part of Bulk Apex Triggers, I have returned trigger on Opportunity to create a Task against that Opportunity when Stage is "Closed Won".

When I have tested by creating Opportunity with Closed Won, it creates Task under that properly. However when I am submit this challenge for review it shows below

Challenge Not yet complete... here's what's wrong: 

There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, ClosedOpportunityTrigger: execution of AfterInsert caused by: System.DmlException: Insert failed. First exception on row 0 with id 00T6F00004GNWjZUAX; first error: INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id] Trigger.ClosedOpportunityTrigger: line 10, column 1: []

Can someone please let me know what exactly the issue here.

Many thanks in advance.

Regards,

Sridhar M
3 Antworten
  1. 12. Mai 2018, 09:54
    Hi Sampath,

    I have gone throw the code again and found there is no separate check for insert and update. For Update operation I was not checking previous Stage value.

    I have rectified this issue and test verified.

    Thanks for your reply.

    -- Sridhar
0/9000