JavaScript function: returnGroupMembers

Returns an array containing the group members of a Configuration Management group.

Syntax

lib.ciGrouping.returnGroupMembers( groupName );

Arguments

The following arguments are valid for this function:

Name Data type Required Description
groupName String Yes This argument contains the name of the configuration group whose members you want to return as an array.

Return values

An array or null.

The function returns an array containing the logical.name values of the group members if there are group members. The function returns null if it cannot find a matching group name or if the group does not have any members.

Description

This function is part of a system JavaScript and should not be directly modified.

This function returns the logical.name values of the members of a Configuration Management group.

  • If the group is a list type, the function returns the array from the group configuration item record.
  • If the group is a query type, the function returns an array of all the CIs it finds.

Example

This example returns the members of the group listed in the variable.

This example requires the following sample data:

  • Create a list group containing one or more configuration items (for example, a list group called "test01" containing the configuration item "DEFAULT Phone 0001")
  • Create a query group containing one or more configuration items (for example, a list group called "test04" containing the configuration items where type equals "telecom")
/* Create variables to store CI group name and the results of returnGroupMembers */
var targetCIGroup;
var members;

/* Test returnGroupMembers on a list group */
print( "Now testing returnGroupMembers on a list group...\n" );
targetCIGroup = "test01";
members = lib.ciGrouping.returnGroupMembers( targetCIGroup );
print( "The current members of " + targetCIGroup + " are:\n" + members );

/* Test returnGroupMembers on a query group */
print( "Now testing returnGroupMembers on a query group...\n" );
targetCIGroup = "test04";
members = lib.ciGrouping.returnGroupMembers( targetCIGroup );
print( "The current members of " + targetCIGroup + " are:\n" + members );