Finding Hardcode user approvals for workflow/Flow designer

rajesh54
Tera Contributor

Hi

How can we identify all requests workflows/flows in ServiceNow where the approval user activity has a single hardcoded approver (either a username or sys_id), instead of a dynamic reference?

Any script for these? or we should go one by one flow?

4 REPLIES 4

Ankur Bawiskar
Tera Patron

@rajesh54 

finding it in workflow is relatively simple, check below

Finding references / sys_ids in Workflows 

For Flow it's somewhat challenging

I used this in past and it helped me to some extent

Flow Designer - Search through flows efficiently with scripts 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

@rajesh54 

Thank you for marking my response as helpful.

please close the thread by marking appropriate response as correct so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Tanushree Maiti
Tera Patron

Hi @rajesh54 

 

You can query workflows  in (wf_activity table and sys_variable_value) and flows (sys_hub_flow and sys_hub_action_instance tables). 

 

1: Querying Workflows (wf_activity table)

  1. Navigate to System Definition > Scripts - Background (or use a background script in Studio).
  2. Run a script to query the wf_activity table looking for activities of type Approval - User or Approval - Group where the variables field contains a hardcoded user's Sys ID or string.

Refer: https://www.servicenow.com/community/developer-forum/how-to-fetch-approval-groups-from-the-workflow-...

 

2.  For Flow : check on table  sys_variable_value and sys_hub_action_instance tables)

When Action type is Ask for Approval, It reference value from sys_variable_value // check the table record value in xml and validate

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

tomblood
Tera Contributor

You don’t have to go one by one...! you can script this by querying sys_hub_flow + sys_hub_action_instance (for Flow Designer) and wf_activity (for legacy workflows) looking for approval steps where approver is a static value.

For flows, check action inputs like approvers or user for hardcoded sys_ids; for workflows, query wf_activity where type = approval and inspect the approver field for static values.

Are you mainly using Flow Designer or classic workflows, or a mix of both?