Searching the Help
To search for information in the Help, type a word or phrase in the Search box. When you enter a group of words, OR is inferred. You can use Boolean operators to refine your search.
Results returned are case insensitive. However, results ranking takes case into account and assigns higher scores to case matches. Therefore, a search for "cats" followed by a search for "Cats" would return the same number of Help topics, but the order in which the topics are listed would be different.
Search for | Example | Results |
---|---|---|
A single word | cat
|
Topics that contain the word "cat". You will also find its grammatical variations, such as "cats". |
A phrase. You can specify that the search results contain a specific phrase. |
"cat food" (quotation marks) |
Topics that contain the literal phrase "cat food" and all its grammatical variations. Without the quotation marks, the query is equivalent to specifying an OR operator, which finds topics with one of the individual words instead of the phrase. |
Search for | Operator | Example |
---|---|---|
Two or more words in the same topic |
|
|
Either word in a topic |
|
|
Topics that do not contain a specific word or phrase |
|
|
Topics that contain one string and do not contain another | ^ (caret) |
cat ^ mouse
|
A combination of search types | ( ) parentheses |
|
- List: JavaScript functions in the ScriptLibrary
- JavaScript function: addToGroup
- JavaScript function: checkAllowedOption
- JavaScript function: checkVersionString
- JavaScript function: isfileexist
- JavaScript function: isInGroup
- JavaScript function: removeFromGroup
- JavaScript function: returnGroupMembers
- JavaScript function: returnMyGroups
- JavaScript function: skipApproval
JavaScript function: returnMyGroups
Returns an array containing all the groups to which a configuration item (CI) belongs.
Syntax
lib.ciGrouping.returnMyGroups( ci, listType );
Arguments
The following arguments are valid for this function:
Name | Data type | Required | Description |
---|---|---|---|
ci
|
String | Yes | This argument contains the CI record you want to search for in your list and query groups. |
listType
|
String | No | This argument contains a string describing which types of configuration groups you want the function to query. The string can have one of four values:
|
Return values
An array of group names.
The function returns an array containing the logical.name values of the list and query groups in which the CI is a member. The function returns an empty array if it cannot find the CI in any list or query group.
Description
This function is part of a system JavaScript and should not be directly modified.
This function returns an array containing the logical.name values of the groups in which the CI is a member. The function queries all group records and does the following:
- If the group is a list type, the function indexes the group.members and if the CI exists in the list group, adds it to the groupArray.
- If the group is a query type, the function uses the RTE function to determine whether the values in the CI record satisfy the search criteria defined by the query.
Example
This example returns the groups containing the CI listed in a variable.
This example requires the following sample data:
- Create a list group containing a single configuration item (for example, a list group called "test01" containing the configuration item "DEFAULT Phone 0001")
- Create a list group containing one or more configuration items (for example, a list group called "test02" containing the configuration item "DEFAULT Phone 0003")
- Create a list group containing one or more configuration items (for example, a list group called "test03" containing the configuration items "HH-000001" and "HH-000002")
- Create a query group containing one or more configuration items (for example, a query group called "test04" containing the configuration items where type equals "telecom")
/* Create variables to store CI group name and the results of returnMyGroups */ var targetCIGroup; var listTypes; var groups; /* Search for a CI in a list group only */ print( "Now testing search for configuration items in list groups only...\n" ); targetCI = "DEFAULT Phone 0001"; listTypes = "list"; groups = lib.ciGrouping.returnMyGroups( targetCI, listTypes ); if ( groups.length >= 1 ) { print( "The list groups containing " + targetCI + " are:\n" + groups ); } else { print( "There are no list groups containing " + targetCI ); } /* Search for a CI in a query group only */ print( "Now testing search for configuration items in query groups only...\n" ); targetCI = "DEFAULT Phone 0001"; listTypes = "query"; groups = lib.ciGrouping.returnMyGroups( targetCI, listTypes ); if ( groups.length >= 1 ) { print( "The query groups containing " + targetCI + " are:\n" + groups ); } else { print( "There are no query groups containing " + targetCI ); } /* Search for a CI in both list and query groups */ print( "Now testing search for configuration items in both list and query groups...\n" ); targetCI = "DEFAULT Phone 0001"; listTypes = "both"; groups = lib.ciGrouping.returnMyGroups( targetCI, listTypes ); if ( groups.length >= 1 ) { print( "The groups containing " + targetCI + " are:\n" + groups ); } else { print( "There are no groups containing " + targetCI ); }