How to find out how many times a workflow is used on other workflows

richelle_pivec
Mega Guru

I have a generic workflow that writes all of the details of the catalog item to comments field on the RITM. (I then suppress the notification that would send that comment.) That workflow is inside of many of my catalog items, but not all of them.

Is there a way for me to get a list of which workflows contain that generic workflow? I tried to see if there was a related list under the Workflow Version that might display a list of all of those workflows, but there doesn't seem to be one. I'd like to make a change to that workflow, but before i do that I'd like to know which catalog items it will impact.

Thanks,

Richelle

1 ACCEPTED SOLUTION

You can open the table wf_workflow_instance



and search for the subworkflow name with filter activity contains your subworkflow name.



Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

6 REPLIES 6

Hi Richelle,



Please try this code below after replace the child workflow sys id and see if it helps you print out the name of catalog item that needs to be modified.





var relevantParentWorkflows = [];




var wfContext =   new GlideRecord("wf_workflow_instance");


wfContext.addQuery("workflow", REPLACE WITH THE CHILD WORKFLOW SYS ID)


wfContext.query();


while(wfContext.next()) {


relevantParentWorkflows.push(wfContext.workflow_version.sys_id + '');


}




var gr =   new GlideRecord("sc_cat_item");


gr.addEncodedQuery("type!=bundle^sys_class_name!=sc_cat_item_guide^type!=package^sys_class_name!=sc_cat_item_content^workflowISNOTEMPTY");


gr.addQuery("workflow", relevantParentWorkflows );


gr.query();


while(gr.next()) {


wfArray.push(gr.name +   '');


}




gs.print(wfArray.join(","));


Thank you for your response,


Richelle