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
Ashmi PatelAshmi Patel 

Variable does not exist: myContct.Email

ERROR : Variable does not exist: myContct.Email

this is my code...

trigger Proposal on Contact (before insert) {
List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>();
for (Contact myContact : Trigger.new)
    {
        if(myContct.Email != null && myContact.FirstName !== null)
        {
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
            List<String> SendTo = new  List<String>();
            SendTo.add(myContact.Email);
            mail.setToAddresses(SendTo);
            mail.setReplyTo('ashmi@aglowiditsolutions.com');
            mail.setSenderDisplayName('BY Ashmi');
            
            mail.setSubject('Business Proposal');
            String body = 'Dear' + myContact.FirstName +', ';
            body += 'hiii';
            body += 'hellooo';
            body += 'kem cho??';
            body += 'its a business proposal...';
            mail.setHtmlBody(body);
            mails.add(mail);
        }
    }
    Messaging.sendEmail(mails);
}


 
Best Answer chosen by Ashmi Patel
Apoorv Saxena 4Apoorv Saxena 4
Hi Ashmi,

It seems like you've misspelled your variable name. In your 'If' condition use 'myContact' in place of 'myContct'.

Please mark this question as Solved if it answers your question.

Thanks,
Apoorv

All Answers

Apoorv Saxena 4Apoorv Saxena 4
Hi Ashmi,

It seems like you've misspelled your variable name. In your 'If' condition use 'myContact' in place of 'myContct'.

Please mark this question as Solved if it answers your question.

Thanks,
Apoorv
This was selected as the best answer
Ashmi PatelAshmi Patel
TYSM