Activity Forums Salesforce® Discussions How can i write a Salesforce trigger to count number of completed task in a single contact?

  • Raghav Chaturvedi

    Member
    June 16, 2017 at 2:23 pm

    I have completed this question till creating a task related with account.and count function is not completed,how can i do this.code is here

    trigger copleteTask on Account (after insert)
    {
    List lst= new List();
    for (account acc : trigger.new)
    {
    Task t = new Task();
    t.status = 'complited';
    t.WhatId = acc.id;

    lst.add(t);
    }

    if (lst.size() > 0) {
    insert lst;
    }
    }

  • Sudhir

    Member
    June 19, 2017 at 3:32 pm

    Click to get to the code: TaskRollUpOnContact

    Hope it helps!

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos