function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Kaaviya P 4Kaaviya P 4 

bulk triggers

what I did 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_EXECUTE_FLOW_TRIGGER, We can't save this record because the “Opportunity Management” process failed. Give your Salesforce admin these details. This error occurred when the flow tried to create records: REQUIRED_FIELD_MISSING: Required fields are missing: [AccountId]. You can look up ExceptionCode values in the SOAP API Developer Guide. Error ID: 44701433-132908 (-667225970): []


trigger ClosedOpportunityTrigger on Opportunity (after insert, after update) {

    List<Task> taskList = new List<Task>();
    
    for (Opportunity opp : [SELECT Id, StageName FROM Opportunity WHERE StageName = 'Closed Won' AND Id IN :Trigger.new]){
                    
            taskList.add(new Task(Subject = 'Follow Up Test Task',
                                  WhatId = opp.Id));
       
    }

    if(taskList.size()>0){
        
        insert taskList;
        
    }
    
}
ShirishaShirisha (Salesforce Developers) 
Hi Kaaviya,

Greetings!

I can see that there is a process on Opportunity itseems named as "Opportunity Management" which is getting failed because of the required field allocation has been missing.

So,I would suggest you to check the process builder and assign the value for the AccountId field to fix the issue.

Kindly mark it as best answer if it helps so that it can help others in the future.

Warm Regards,
Shirisha Pathuri
Kaaviya P 4Kaaviya P 4
yeah mam it works.Thank you 
Kaaviya P 4Kaaviya P 4
one more mam!

Challenge Not yet complete... here's what's wrong:
A validation rule did not prevent a new Account from being saved when Billing Country is blank and Billing State has three characters.

Im trying for long time,But I couldn't complete.