Welcome Login
Blog Photos Links

RSS Feed

Identify workflows where a group is listed

January 17, 2018, 4:43 pm - James Farrer

 Here's a script that goes through the workflow activity fields and prints out where the group is listed in workflows.

// Sys ID of the group that we're testing for
var group_id = "c4762f920fd0310066e76ab8b1050e58";

var group_gr = new GlideRecord("sys_user_group");
if (group_gr.get(group_id)) {
	gs.print("Querying workflows for group: " + group_gr.getDisplayValue());
}
var wf_var_value_gr = new GlideRecord("sys_variable_value");
wf_var_value_gr.addQuery("value", group_id);
wf_var_value_gr.query();
while (wf_var_value_gr.next()) {
	// Query for the workflow activity
	var wf_activity_gr = new GlideRecord(wf_var_value_gr.document);
	if(wf_activity_gr.get(wf_var_value_gr.document_key)) {
		if(wf_activity_gr.workflow_version){
			// Query for the workflow version
			var wf_version_gr = new GlideRecord("wf_workflow_version");
			wf_version_gr.addQuery("sys_id", wf_activity_gr.workflow_version);
			wf_version_gr.addQuery("published", true);
			wf_version_gr.query();
			if (wf_version_gr.next(wf_activity_gr.workflow_version)) {
				gs.print("Group is assigned to " + wf_version_gr.name + " -> " + wf_activity_gr.name);
			} else {
				//gs.print("WF version not published " + wf_activity_gr.workflow_version.getDisplayValue() + " -> " + wf_activity_gr.name);
			}
		} else {
			gs.print("Workflow activity version is blank for " + wf_activity_gr.name);
		}
	}
}

What's New

There are currently no new items, please check back later.

Archives
2021 (2)
  September (1)
  May (1)
2019 (1)
  August (1)
2018 (3)
  August (1)
  April (1)
  January (1)
2017 (1)
  January (1)
2016 (4)
  December (1)
  November (1)
  May (1)
  January (1)
2015 (1)
  December (1)
2014 (2)
  August (1)
  February (1)
2013 (4)
  October (1)
  July (1)
  June (1)
  April (1)
2012 (11)
  December (2)
  October (3)
  September (1)
  May (1)
  April (1)
  February (2)
  January (1)
2011 (14)
  December (1)
  November (1)
  September (2)
  July (2)
  June (1)
  May (1)
  April (2)
  March (3)
  January (1)
2009 (2)
  October (1)
  June (1)
2008 (1)
  September (1)