Activity Forums Salesforce® Discussions Help needed on a Salesforce Trigger manipulating Contact Object

  • Charan Tej

    January 2, 2018 at 8:22 am

    Whenever you send an email, you need to create an activity under that record. This helps you in tracking the last email sent for that record.

    Trigger should be developed on Task.

    trigger TaskTrg on Task (after insert) {

    List<Contact> lstCons = new List<Contact>();
    for(Task tObj :{
    if(tobj.whatId != null && string.valueof(tobj.whatId).startswith('003')){
    Contact con = new Contact(Id=tObj.whatId);
    con.LastEmailSentTime__c =;

    con.LastTaskCreatedTime__c =;

    update lstCons;


Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos