Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Recompile a WORKFLOW from within a Fix Script?

tracymckibb
Tera Contributor

Background: we're doing a major cleanup and overhaul of stage names, standardizing names and spellings, removing duplicate stage names, etc., impacting a large number of FLOWS and WORKFLOWS. Rather than manually opening up each flow and workflow and manipulating the stages names, we've written a fix script that updates the stage tables (wf_stage, sys_hub_flow_stage, wf_stage_default, and stage_set_entry) through queries.

 

After updating and confirming the tables were correct, we also confirmed that the new stage names appear correctly within Flow Designer and Workflow Editor. However, the OLD stage names continue to be used in any newly generated RITMs produced by these same flows/workflows, until we take some action to trigger a recompile of the impacted flows/workflows, an action such as deactivating/activating a flow, or modifying/publishing a workflow.

 

The desire is to avoid manually touching dozens of individual flows and workflows, and to do this programmatically if possible.

 

I found that there is an API available to recompile a FLOW - 

sn_fd.FlowAPI.getRunner().flow(flow scope+name).compile(true)
 
I cannot find anything similar for a WORKFLOW. I'm hoping somebody here can tell me how to recompile a WORKFLOW from within a Fix Script using an API call or some other mechanism.
1 ACCEPTED SOLUTION

Community Alums
Not applicable

Hi @tracymckibb ,

There isn’t a supported API to directly recompile legacy Workflows the way you can with Flows. For Workflows, the common approach is to programmatically update or republish them (e.g., toggling active state or using Workflow API methods) to trigger recompilation. Otherwise, manual publish/activate is required. If you’re standardizing long-term, consider migrating those processes into Flow Designer, which offers more programmatic control.

Thanks & Regards,
Muhammad Iftikhar

If my response helped, please mark it as the accepted solution so others can benefit as well.

View solution in original post

1 REPLY 1

Community Alums
Not applicable

Hi @tracymckibb ,

There isn’t a supported API to directly recompile legacy Workflows the way you can with Flows. For Workflows, the common approach is to programmatically update or republish them (e.g., toggling active state or using Workflow API methods) to trigger recompilation. Otherwise, manual publish/activate is required. If you’re standardizing long-term, consider migrating those processes into Flow Designer, which offers more programmatic control.

Thanks & Regards,
Muhammad Iftikhar

If my response helped, please mark it as the accepted solution so others can benefit as well.