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.

  • 2
    In short, you will need a batch class to change the ownership, scheduled at the end of the day. – Jayant Das Feb 26 '19 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 '19 at 23:18
  • 2
    you might look at Doug Ayers' Mass Action Scheduler (Appexchange - Lightning only) – cropredy Feb 27 '19 at 0:46
-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

| improve this answer | |
  • 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. – Sebastian Kessel Feb 27 '19 at 1:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.