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
Amit VisapurkarAmit Visapurkar 

Having issues when trying to load data using data loader

When  i insert data using data loader a contact should be created and after that another record should be created in another object. I have implemented the functionality using a trigger . But when i try to insert data it gives an error  :  enitity is deleted. and i am not able to load the records.

Below is the trigger for the contact creation.

trigger CreateParticipant on Contact (after insert) {
    List<Participant__c> newparticipant= new List<Participant__c>();
    
    for (Contact newPosition: Trigger.New) {
        if (newPosition.Id!=null) {
            newparticipant.add(new Participant__c(
                         First_Name__c=newPosition.FirstName,
                         Middle_Name__c=newPosition.MiddleName,
                         Last_Name__c=newPosition.LastName,
                         Birthdate__c=newPosition.Birthdate,
                         Gender__c=newPosition.Gender__c,
                         Mobile__c=newPosition.MobilePhone,
                         Work_Phone__c=newPosition.Phone,
                         Email__c=newPosition.Email,
                         Payor__c=newPosition.Payor__c,
                         Contact__c=newPosition.Id,
                         Network_Partner__c=newPosition.Network_Partner_Name__c));
        }
    }
    insert newparticipant;
}

Please help it's urgent
Amit Chaudhary 8Amit Chaudhary 8
Please check below point in your org
1) Please check you have any trigger which is deleting record
2) Please check you are using any record lookup on contact object which is deleted from org ?