• Amit Visapurkar
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 6
    Replies
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
Below is my controller code

I am facing the following error : Invalid bind expression type of Participant__c for column of type String

public class MyCustomController14
{

Id str=apexpages.currentpage().getparameters().get('id');  
  
 public List<Class__c> listOfCustomObjs1 {get; set;}

 public Class__c CustomObjs1{get;set;}
 public List<Course__c>courselst;
 public List<Class__c>classlst;
 public List<Participant__c>partlst;
 public List<Sessions__c>sesslst;

    private final Class__c speaker{get;set;}
    //public string message{get;set;}
    private ApexPages.StandardController stdController;
    
 public MyCustomController14(ApexPages.StandardController stdController) {
            
        this.speaker = (Class__c)stdController.getRecord();
        this.stdController = stdController;
        //message = '';
    }
    
    public MyCustomController14() {
       listOfCustomObjs1 = [SELECT Class_Date__c,Coach__c,Name,Location_Name__c,Total_Participant__c FROM Class__c];
       system.debug('PARTLIST***********************************111111');
      
    }
   
 
    public List<Sessions__c> getSesslst() {    
    classlst = [select id from Class__c where Id=:str];
    partlst = [select id,Name,First_Name__c  from Participant__c where Class_Attending__c =:classlst];
    sesslst = [select Participant_Name__r.First_Name__c,Weight__c,Minutes_of_Physical_Activity__c,Food_Logged__c from Sessions__c where Participant_Name__r.Name =:partlst];      
    system.debug('sesslst***********************************'+sesslst );
     return sesslst;
    }
 
       public PageReference save(){
         update sesslst;
         return null;
    }
   
 } 

When i run the query select Participant_Name__r.First_Name__c,Weight__c,Minutes_of_Physical_Activity__c,Food_Logged__c from Sessions__c where Participant_Name__r.Name =:partlst and use a static id in place of partlst it's returning records in workbench.

Please help it's very urgent.

Thanks

Error: Invalid Data. 
Review all error messages below to correct your data.
Please enter another value.

I want to show only the third line and not the first two lines.The method used is  newOpp.adderror('Please enter another value.)

Please help it's urgent 
Object X has a lookup with Object Y. I want to show the count of number of records in Y on X . Also  want to restrict the use from creating further records if records are more than 10 in Y.

Please help it's urgent
When I run the code get the following error.

Error: Compile Error: Method was removed after version 34.0: setPhoto

What is the new method?
Below is my controller code

I am facing the following error : Invalid bind expression type of Participant__c for column of type String

public class MyCustomController14
{

Id str=apexpages.currentpage().getparameters().get('id');  
  
 public List<Class__c> listOfCustomObjs1 {get; set;}

 public Class__c CustomObjs1{get;set;}
 public List<Course__c>courselst;
 public List<Class__c>classlst;
 public List<Participant__c>partlst;
 public List<Sessions__c>sesslst;

    private final Class__c speaker{get;set;}
    //public string message{get;set;}
    private ApexPages.StandardController stdController;
    
 public MyCustomController14(ApexPages.StandardController stdController) {
            
        this.speaker = (Class__c)stdController.getRecord();
        this.stdController = stdController;
        //message = '';
    }
    
    public MyCustomController14() {
       listOfCustomObjs1 = [SELECT Class_Date__c,Coach__c,Name,Location_Name__c,Total_Participant__c FROM Class__c];
       system.debug('PARTLIST***********************************111111');
      
    }
   
 
    public List<Sessions__c> getSesslst() {    
    classlst = [select id from Class__c where Id=:str];
    partlst = [select id,Name,First_Name__c  from Participant__c where Class_Attending__c =:classlst];
    sesslst = [select Participant_Name__r.First_Name__c,Weight__c,Minutes_of_Physical_Activity__c,Food_Logged__c from Sessions__c where Participant_Name__r.Name =:partlst];      
    system.debug('sesslst***********************************'+sesslst );
     return sesslst;
    }
 
       public PageReference save(){
         update sesslst;
         return null;
    }
   
 } 

When i run the query select Participant_Name__r.First_Name__c,Weight__c,Minutes_of_Physical_Activity__c,Food_Logged__c from Sessions__c where Participant_Name__r.Name =:partlst and use a static id in place of partlst it's returning records in workbench.

Please help it's very urgent.

Thanks
Object X has a lookup with Object Y. I want to show the count of number of records in Y on X . Also  want to restrict the use from creating further records if records are more than 10 in Y.

Please help it's urgent