CIRelatedList - Global
-
- UpdatedJan 30, 2025
- 4 minutes to read
- Yokohama
- API reference
The CIRelatedList script include is a utility class that provides methods for working with configuration item (CI) related lists.
Each instance of this script include contains the details of a single list that is related to a particular CI. The details of this list and the contents of the list are included.
Use with any server-side discovery script.
CIRelatedList - addRec(Object record)
Adds the specified record to the related list.
Name | Type | Description |
---|---|---|
record | Object | Each member in the object is a column name in the associated table. For
example, if referencing the cmdb_serial_number table this value may contain
something similar to the
following:
|
Type | Description |
---|---|
void |
Example
This example shows how to add a record to a CI related list.
Output:
CIRelatedList - addRecs(Array records)
Sets the given records to the related list.
Name | Type | Description |
---|---|---|
records | Array of Objects | Each object represents a record in the associated table. Each member in the
object is a column name in that table. For example, if referencing the
cmdb_serial_number table this value may contain something similar to the
following:
|
Type | Description |
---|---|
void |
Example
This example shows how to add multiple records to a CI related list.
Output:
CIRelatedList - appendXMLChildFld(String parent, String name, String datum)
Appends an XML child to a field.
Name | Type | Description |
---|---|---|
parent | String | The parent element |
name | String | The element name |
datum | String | The data to append |
Type | Description |
---|---|
void |
CIRelatedList - appendXMLChildRecord(String parent, String name, String record)
Appends an XML child to a record.
Name | Type | Description |
---|---|---|
parent | String | The parent element |
name | String | The element name |
record | String | The record |
Type | Description |
---|---|
void |
CIRelatedList - checkSysCollection()
Checks to see if this is a SysCollection table. If it is, sets the target table name and reference field name.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
CIRelatedList | An instance of CIRelatedList for the specified list. |
CIRelatedList - checkSysM2M()
Checks to see if this is a Sys many-to-many table. If it is, sets the target table name and reference field name.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
Boolean | True if it is a sys many-to-many table; otherwise, false. |
CIRelatedList - CIRelatedList(String table, String refField, String cmdb_ci, String debugFlag)
Creates an instance of the CIRelatedList class. With no arguments, simply constructs an empty instance.
CIRelatedList - fromXML(String element)
Initializes this instance from the specified XML element.
Name | Type | Description |
---|---|---|
element | String | An XML element |
Type | Description |
---|---|
void |
CIRelatedList - populate()
Populates the this.records
field of this instance.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
void |
CIRelatedList - toString(Array result)
Makes a string representation of this instance, pushing each line onto the end of the given result array.
This method is called from CIData.toString(), and assumes related list lines are to be indented two spaces.
Name | Type | Description |
---|---|---|
result | Array | The result to convert |
Type | Description |
---|---|
void |
CIRelatedList - toXML(String document, String element)
Serializes this instance to XML in the given document and <rl> element.
Name | Type | Description |
---|---|---|
document | String | The document |
element | String | The rl element |
Type | Description |
---|---|
void |
CIRelatedList - remove()
Removes all the related list items.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
void |
Example
This code example deletes the related records mapped with the CI items with the name = *JEMPLOYEE-IBM. This example is for a non-M2M table.
CIRelatedList - xmlToRecord(String records, String element)
Converts a related list from XML to record format.
Name | Type | Description |
---|---|---|
records | String | The record to create |
element | String | The XML element |
Type | Description |
---|---|
void |
On this page
- CIRelatedList - addRec(Object record)
- CIRelatedList - addRecs(Array records)
- CIRelatedList - appendXMLChildFld(String parent, String name, String datum)
- CIRelatedList - appendXMLChildRecord(String parent, String name, String record)
- CIRelatedList - checkSysCollection()
- CIRelatedList - checkSysM2M()
- CIRelatedList - CIRelatedList(String table, String refField, String cmdb_ci, String
debugFlag)
- CIRelatedList - fromXML(String element)
- CIRelatedList - populate()
- CIRelatedList - toString(Array result)
- CIRelatedList - toXML(String document, String element)
- CIRelatedList - remove()
- CIRelatedList - xmlToRecord(String records, String element)