Evolve Works

NHS ESR Automation: Surrey and Borders NHS Trust

ESR, unattended, every night. An overnight reporting robot made reliable, and handed over as a pattern the Trust now builds on.

6
Root causes found and fixed
4
Further desktop flows the Trust built from the same template
Daily
Staff in Post extract, running unattended

We have achieved sustained reliability in our daily Staff in Post reporting, while successfully extending the same automation approach across additional workflows, establishing a scalable and repeatable foundation for future automation.

Craig laBuscagne, Workforce Intelligence Manager, Surrey and Borders Partnership NHS Foundation Trust

Surrey and Borders Partnership NHS Foundation Trust was automating its ESR reporting with Power Automate. ESR’s reporting portal is difficult to automate in a browser, and the daily Staff in Post flow was not yet reliable unattended. We traced every failure to its cause, fixed each one, and handed over a pattern the Trust’s own team now uses to build more.

The Challenge

The Workforce Intelligence team wanted the daily Staff in Post report and other ESR extracts pulled overnight, with nobody logging in to do it by hand.

ESR’s reporting portal loads content in the background, uses page identifiers that change between sessions, and shows pop-ups that may or may not appear. Each of those can stop an unattended flow, and other flows were waiting on this one.

The Constraint

The flow runs unattended on a virtual PC. Nobody is there to click retry, so every step has to recover by itself, or fail cleanly and record why.

It also drives the ESR Business Intelligence portal, which loads content in the background and is outside the Trust’s control.

The Approach

We instrumented each failing action. Every failure traced to one of six causes: selectors tied to dates or session tokens, clicks fired before the page had rendered, script-driven buttons that ignore a standard click, forced shutdowns that reopened old windows, renames that raced the download, and a pop-up that appeared a moment too late to be dismissed.

Each had a specific fix: stable selectors, readiness waits at each page transition, script-level clicks, a controlled browser launch and clean close, a wait-for-file before rename, and a bounded wait for the pop-up. Output now lands in SharePoint.

We then built a second flow, Education Staff in Post, by copying the stabilised one, and wrote the whole method up as build notes with a pre-go-live checklist. The Trust’s lead built alongside us from the first session, so the know-how stayed in the Trust.

What changed

  • Daily Staff in Post extract running unattended on schedule
  • Six root causes found and fixed
  • Second flow, Education Staff in Post, built from the same template
  • Trust team built four further desktop flows from the pattern
  • Trust replaced tab clicks with direct report links, using the build notes
  • Extract lands in SharePoint and loads into SQL, ready for Power BI
  • Build notes and pre-go-live checklist handed over for any unattended browser flow

Healthcare / NHS

Automations that keep failing?

We find why Power Automate and RPA flows fail, fix the causes, and leave your team able to build the next ones. Delivered. Not promised.