2

Context: I have a class that is scheduled to run in an hourly basis, and it unfortunately updates a few dozens of records when it is run. As a result, I get these records on my "recent viewed" list, and they get marked as "last modified by Renato".

Since this is an automated process, I would like if it is possible to hide them from the recently viewed list and replace my user in the process by a "system user", similar of those when using Platform Events or when a case is created through Email-to-Case.

6
  • You could use Platform Events.
    – Adrian Larson
    Dec 6, 2017 at 16:23
  • So I would have a scheduled class to insert a platform event that would trigger this workflow? Dec 6, 2017 at 17:01
  • Right, that's the idea.
    – Adrian Larson
    Dec 6, 2017 at 17:02
  • 1
    I don't think they count against your storage usage if that's what you are asking. They don't show up in my org anyway.
    – Adrian Larson
    Dec 6, 2017 at 17:13
  • 1
    I think Platform Events records only persist for 24 hours, after which they are deleted Dec 6, 2017 at 20:44

1 Answer 1

5

Personally, I like to see who the running user is doing the updating that is associated with the scheduled class. Furthermore, this user should be a headless user someUsefulNameForTraceability@mycompany.com so that when, you, Renato, take a job in new company, the scheduled job doesn't break because the running user is inactive. This approach requires burning (consuming) an SFDC User seat so $$ are involved.

@Adrian Larson's suggestion of using Platform Events will use the Automated Process user as per the documentation. You are not bound to use triggers, you can also consume the events with flows or Process Builder.

But if you go this route, you lose some context as to why the records were updated although you still should run the scheduled class as a headless user.

3
  • The thing is that I know why they are being updated. It is an automated process, after all! So it just doesn't make sense to burn a license for this. Thank you for your answer. Dec 6, 2017 at 17:25
  • you know why they are updated but the next poor guy/gal may not
    – cropredy
    Dec 6, 2017 at 17:27
  • 1
    Only if they don't read the manual, though. ;) Dec 6, 2017 at 17:47

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.