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
Ankit Khurana24Ankit Khurana24 

how to perform this...?

Whenever a new contact is created under an account, system should create a task for the loged in user and an email should go to the mail id of the contact

Santosh KumbarSantosh Kumbar

Write a workflow on contact, that has two actions : 1. Create Task.  2. Send Email

 

Reagrds

Santosh

www.santoshkumbar.com

jd123jd123

 You can do by workflow rule or Trigger

 

I am sending one sample trigger.You can write trriger for Contact object 

 

 

trigger Email_Notification on Technician_Assignment__c (after insert,after update) 
  {
    LIST<Technician_Assignment__c > ta= trigger.new;

   Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        if(tech.Employees__r.E_mail__c!=null)
          {
            String[] etoaddress=new String[]{tech.Employees__r.E_mail__c};
            mail.setToAddresses(etoaddress);
          }
        if(tech.Contact__r.email!=null)
          {
            String[] ctoaddress=new String[]{tech.Contact__r.email};  
            mail.setToAddresses(ctoaddress);
          }
        mail.setsubject('Service Order Activity Information');
        mail.setPlainTextBody('Service Order ID: '+activity.Service_Order__r.Name+'\n\n'+'Activity Step No : ' +activity.Name+ '\n\n'+ 'Priority : '+activity.Priority__c );
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});
        User u = [SELECT id,name FROM User WHERE Email=:tech.Employees__r.E_mail__c ];
        Task t = new Task(ownerId = u.id,  Subject='Service Order Avtivity', ActivityDate=ta[0].Activity__r.Date__c, whatid=ta[0].id  );   
        insert t;
      }

 

If your question is resolved please mark it as accept as a solution, If not please let me know.