0

I'm trying to figure out the best way to transfer Account ownership of certain accounts once a day. I would use declarative tools but can't because the data that would fire the automation is coming from a couple of custom formula fields. I'm confused whether I need to write a scheduled class, a batch class or a scheduled batch class. I've gone through trailhead and sfdc help docs and am still unclear on how to accomplish this. Any pointers on how to get started are much appreciated.

3
  • 2
    In short, you will need a batch class to change the ownership, scheduled at the end of the day.
    – Jayant Das
    Feb 26, 2019 at 22:58
  • 1
    Changing ownership on a daily, automated basis is unusual enough to make me wonder if this could be an x-y problem.. is it possible some other visibility solution could solve your underlying objective?
    – David Reed
    Feb 26, 2019 at 23:18
  • 2
    you might look at Doug Ayers' Mass Action Scheduler (Appexchange - Lightning only)
    – cropredy
    Feb 27, 2019 at 0:46

1 Answer 1

-1

Try this

global class SchedulableClass implements schedulable
{
    global void execute(SchedulableContext sc)
    {
      Batchclass b = new Batchclass (); //your batch class
      Database.executebatch(b);
    }
}

In the Apex Class page (Setup -> Apex Classes) there is a button called "Schedule Apex". Click that and schedule this apex class on a daily basis

1
  • What does this do? How is this moving the account's owner? I would recommend you both expand on the answer and also add explanations so the OP actually derives a benefit from your answer. Feb 27, 2019 at 1:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .