Skip to main content

The batch class runs in the context of the user who scheduled it.

Now, in the global query of the batch, it's fetching 5000 user records one by one. In the execute method, I want to run 9 queries on different object in the context of the same user who is being fetched one by one from the global query. Or, I want those 9 queries to fetch only records that are accessible(read access) to that user, like the record the user has in the current execute method."

@* Salesforce Administrators * @* Salesforce Platform * @APAC Architects @Astro TrailBlazer #Trailhead Challenges #Sales Cloud #Apex @ASHISH AGARWAL @8D: EDU Architecture Excursion
12 个回答
  1. 2023年10月23日 08:10

    I am tempting to agree with @Alan McQueen here, questioning the approach 

     

    5000 users with records from 9 objects emailing out 

    5000 emails with 90 records in there, sounds like a bad idea.

     

    If we would have a bit more details we might be able to help more efficiently.

     

    My initial idea here was , why not create a Dashboard out of 9 reports (  the objects)

    and put that dashboard on the home page for each user? so they see it on Monday morning as soon they login.