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
Waseem AkramWaseem Akram 

Autoresponse to the email, record should be created automatically

I Wrote a code to send email alerts to all contacts when an event is created. But my question is when we respond to that email then automatically a record should be created in child object named Participants for which Event is a parent. How to achieve this??

My code is: 

Global class CreateInboundMember implements Messaging.InboundEmailHandler {
Global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email, Messaging.InboundEnvelope env) {
    
        Messaging.InboundEmailResult result = new Messaging.InboundEmailResult();
          
        String myPlainText= '';     
            
        myPlainText = email.plainTextBody;  
        
        List<Participants__c> part = new List<Participants__c>();
          
        try {
            contact c=new contact();
            Participants__c p = new Participants__c(Name__c=c.Name, Email__c=c.Email);
            part.add(p);
            insert part;                 
            System.debug('New Participant: ' + part);   
        } 
            
        catch (Exception e) {
            System.debug('Error is: ' + e);
        }   
          
        result.success = true;
         
        return result;
    }
}

Please correct me if i am wrong