Hey there, I am doing an implementation for my client who requires service reports to be generated for their Work Order Line Items on a regular basis.
I have created a daily scheduled Flow that finds all completed Work Order Line Items for that day and loops through each record to create Service Report records for each of those WOLIs.
I am running the flow as a System Administrator user and it works fine when I debug it, but when I activate the schedule triggered flow I get the following error: "INSUFFICIENT_ACCESS_OR_READONLY: null. You can look up ExceptionCode values in the SOAP API Developer Guide.---This error occurred when the flow tried to create records:"
I can't access the Sharing Settings for Service Reports or Work Order Line Items but the user running the flow (who is the same as the Default Workflow User in the Process Automation Settings) is System Admin with ability to View and Modify all data in the environment.
Any ideas? Thanks in advance!
Hi Iqbal, it's been a while and that flow has since been retired, so I can't check the exact build. From memory and what's left in our org, I didn't fix it in the scheduled flow. The error only occurred in the schedule-triggered context; Debug works because it runs in your own logged-in session. Generating a Service Report renders the template into a PDF, which appears to need a real user session. A scheduled run doesn't have one, even as a System Admin with Modify All Data, so it fails with INSUFFICIENT_ACCESS_OR_READONLY: null. What worked for us was moving report creation out of the scheduled flow and into a context started by a logged-in user. We used a record-triggered flow that fires when the record is completed, and an admin-run bulk process to catch up the backlog. If you need it unattended, I'd try having the scheduled flow update a flag on the records and letting a record-triggered flow create the report. Hope that helps!