Modernizing a Complex Legacy ServiceNow Workflow with Generative AI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
In the continuing migration effort started here: What do you do with more than 500 legacy ServiceNo... - ServiceNow Community, I would like to provide some details about migrating one of our more complex legacy workflows.
The Problem
One of our organization's ServiceNow focus this year is migrating hundreds of processes off the ServiceNow legacy workflow engine and over to flow designer. One of the more challenging parts of this effort is that some of our older workflows can contain large complex multi-step processes on a single canvas, that underwent years of organic growth. The old legacy workflows often look like a bowl of spaghetti and can be very difficult to trace the logic out of.
Having run our AI assisted legacy workflow migration process against ~30 or so of the more simple workflows in our inventory already this summer, it was time to tackle one of these monsters. A workflow was selected that was at the upper end of complexity. The workflow process has nearly one hundred activities on the canvas, all squeezed onto a canvas the size of a 15" laptop screen. Additionally, the exported workflow update set XML file is over one MB in size. The workflow editor itself was so crowded that even manual navigation for analysis was impractical.
The Process
At the beginning of the migration project this summer, a process to quickly analyze the legacy workflow was developed by feeding a high resolution screenshot of the workflow canvas, along with the XML export of the workflow (capture in update set and export update set to file) to generative AI for analysis with some custom prompt instructions for the workflow breakdown into a text based format. By feeding the screen capture image of the workflow canvas and the workflow update set XML to a multi-modal generative AI model, we can quickly reduce the workflow to a document that our analysis and developers can use to migrate the logic quickly to flow designer.
Attempts to run this process against this high complexity "red" grade workflow was unsuccessful. As of Oct 2025, we have a 0.5 MB restriction on a single file update to the AI model. The file size limit prevented direct analysis of the XML file in the same manner as was used for the smaller workflows. Screenshots of the workflow were also far too dense for image analysis by AI. Attempts to analyze this screenshot by generative AI using our process would result in a mess of text in the AI generated analysis document that was unusable. Attempts to cut the XML file in chunks also proved unsuccessful for accurate analysis by the multi-modal AI.
The Backup-Plan
After failing at using the established process, a re-attempt at analysis was started by focusing on the production data. The starting point was extracting real request records from a clone of production. Data mining scripts were built using the AI to sample a representative set of actual user submissions in the prod clone environment and then saving the ticket data to a JSON blob for export. Additionally, a PII scrub is performed on the exported data before any further use in sub-prod. Using a fix script and the Service Now catalog cart API, we were able to replay the prod ticket data into new request item records in sub-prod for analysis. After processing all the approvals and tasks for these replay records, it could be observed how the legacy workflow executed across all possible logic branches, task assignments, and approval chains. Generative AI was used to analyze the mined dev request item data which consisted of the requested item details, child approvals, and child tasks. The AI was used to convert the mined requested item behavior in dev into a step-by-step document to fully describe the process behavior. This ground truth provided not only accurate business process insight, but also a baseline process understanding against which the tangled legacy workflow could be picked apart.
After this data driven first pass analysis, a second attempt was made to untangle the legacy workflow in the ServiceNow editor. By increasing the workflow canvas size by 200-300%, and bulk-moving all workflow activities to the right side of the canvas, the workflow could slowly be picked apart step-by-step. Using the patterns discovered through data mining and replayed production records—it was possible to methodically reposition the legacy workflow activities and connection lines into a more readable format. This visual untangling, guided by real process knowledge, revealed logical groupings and branch patterns that had previously been obscured, and within about an hour the workflow was readable and ready for deep analysis. This version of the workflow, with readability in mind of the layout, can then be used by a developer as a reference to clarify anything not fully captured in the AI analysis document.
The Build-out
With the untangled workflow and workflow-to-text document in hand, Generative AI is again leveraged to assist with architecting the migration. A text file was created with a copy-paste of all the text of the previous 30 flows and sub-flows built so far for the migration effort. The AI was asked to analyze this file, determine the existing migration patterns for the first 30 efforts, and design a migration plan following our template-driven approach. With some refinement of the plan to align with internal standards, the buildout in flow design could then begin.
The build-out starts by making copies of starter templates flows and sub-flows, which include request, approval and fulfillment. The new sub flows and parent request flow are connected together. Then a mockup of the logic is first built out in the sub flows using placeholder flow steps and placeholder data pills. To validate the flow mockup, the text can be copied out of flow designer for each sub-flow and fed back into the generative AI along with the legacy workflow analysis document to ensure all logic branches are accounted for during mockup. Once the mockup logic in flow designer is correct, we can begin the process to migrate each legacy workflow activity to its new corresponding flow action or flow step. In the next post, we will discuss our data mining approach for unit testing the migrated flows.
- Labels:
-
Service Catalog
