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
Prabhjot KPrabhjot K 

Create triggers

Hi, I am trying to create a trigger for my client.T his is what I amtrting to do
  • There is a lead path, having deposit field (checkbox), once the check box is clicked and path updated, I want to send an email to the client with "attached forms" asking them to fill it to go further on process. By now this is teh code I was able to create:
  • Working class for EMailManager ---

    public with sharing class EmailManager
    {
        public static void sendMail(String address, String subject, String body)
            {
                Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                String[] toAddresses = new String[] {address};
                    
                mail.setToAddresses(toAddresses);
                mail.setPlainTextBody (body);
                mail.setSubject(Subject);
                Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});       
            }
            
    }Problem is: 1. How can I get particular field from the path on the lead object?
  • 2. how to send email to client who paid the deposit and whose field got udated?
  • Please help, I am new to trigggers and really struggling to find the solution.
Thank you.
Best Answer chosen by Prabhjot K
Naren9Naren9
Good that your issue got resolved. if it helps, please mark as Best answer.

Thanks,
Naren

All Answers

Britto Fernandez 2Britto Fernandez 2
Hi Prabhjot,

How is your client linked to lead ? Did you create a custom link ?

For email ​​- are you using template ?​​​​​
Prabhjot KPrabhjot K
Hi Britto,
The clients in the lead object are prospective clients to be enrolled in the education course, they have to follow a process for enrollment. I created a path for this process and paying the deposit fee is one of it. Once the payment is received by my client via PayPal they update the deposit checkbox, and after that they want to use trigger to send email to the client for further screening forms. Either template or attachement for sending forms can be used. Please suggest which way works better?
Thanks.
 
Naren9Naren9
Hi Prabhjot,
We can send the emails by using the Workflow Rules.
In Workflow rules, you can check for the deposit field is updated, then you can do a Immediate action as Send Email. In the Send Email, you can choose email Template and in Template, you can populate the Lead Fields information by using a {!Lead.FirstName} ..Notation.

Thanks,
Narendar
Prabhjot KPrabhjot K
Hi Naren,
Thank you for providing the solution, it worked perfectly for me.
Thanks again,
Prabhjot
Naren9Naren9
Good that your issue got resolved. if it helps, please mark as Best answer.

Thanks,
Naren
This was selected as the best answer