Activity Forums Salesforce® Discussions How can I delete activities related to lead through salesforce apex code?

  • Vikas Kumar

    Member
    January 23, 2017 at 7:34 am

    Hi pranav ,

    you can try something like this

    List<Lead> leadList = [SELECT Id FROM Lead ];

    for(Task objTask:[Select Id, Subject, WhoId FROM Task WHERE WhoId IN: leadList )

    {----Delete related task here-----

    ----or save it in list and delete at last ----

    }

    Hope it may Helps

    Thanks

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos