
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-30-2020 11:43 PM
Quite often in CMP you will call this function
res = new sn_cmp_api.ExpressionResolverUtilScript().getMetadataRelations(
sys_id,
'Contains',
tableName,
'flat',
1,
param
);
It returns JSON string from the relationships that is suitable in the catalog items. How ever I haven't seen any documentation what does the `flat` and `1` parameters do. Can someone explain what are the extra parameters? Can you find the source code of this class and methods?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2020 06:28 AM
Internally to evaluate all the expressions of cloud management, expression util is used.
Expression documentation is here
https://docs.servicenow.com/bundle/orlando-it-operations-management/page/product/cloud-management-v2/reference/expressions-cloud-mgt.html
Let me explain the specific method signature and possible values here
getMetadataRelations(sys_id, metadataRelation, targetCIType, loadType, level, param );
This method helps you to flaten the relationship and gets the value in key-value pair needed for your filter.
Given a top level sysId like Location, ServiceAccount, CloudAccount sysId, you can get the related child members. This method works on cmdb_rel_ci, instead of you explicitely querying the table with join, this helper method simplifies the overall code.
- sys_id = sysId of current record which is either parent or child in cmdb_rel_ci table
- metadataRelation = relationship in cmdb_rel_ci table
- targetCIType = type of child or parent you are looking for ( they change based on if you ask for HostedOn:Hosts or reverse ) - typical values Hosts, Contains, else whatever is passed
- loadType , levels =doesnt matter what you pass, its deprecated.
- parms - keyAttributes and valueAttributes - values to extract from found entity.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-31-2020 01:44 AM
Hi Sami Koskivaara,
'Flat' and '1' means Level 1 Relationship from table.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2020 11:47 PM
What other options are there for `flat`? Where is this documented? How `flat` is different from `1` level relationship parameter?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2020 06:28 AM
Internally to evaluate all the expressions of cloud management, expression util is used.
Expression documentation is here
https://docs.servicenow.com/bundle/orlando-it-operations-management/page/product/cloud-management-v2/reference/expressions-cloud-mgt.html
Let me explain the specific method signature and possible values here
getMetadataRelations(sys_id, metadataRelation, targetCIType, loadType, level, param );
This method helps you to flaten the relationship and gets the value in key-value pair needed for your filter.
Given a top level sysId like Location, ServiceAccount, CloudAccount sysId, you can get the related child members. This method works on cmdb_rel_ci, instead of you explicitely querying the table with join, this helper method simplifies the overall code.
- sys_id = sysId of current record which is either parent or child in cmdb_rel_ci table
- metadataRelation = relationship in cmdb_rel_ci table
- targetCIType = type of child or parent you are looking for ( they change based on if you ask for HostedOn:Hosts or reverse ) - typical values Hosts, Contains, else whatever is passed
- loadType , levels =doesnt matter what you pass, its deprecated.
- parms - keyAttributes and valueAttributes - values to extract from found entity.