Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Metrics Related List is only on INC records, how to add to other record types?

Mike Beardsley
Mega Contributor

I have tried many different things to have the Metrics Related List available on different record types, requested items specifically, and also a custom built ADHOC table.

1. I've looked at the Metrics relationship and everything looks good there. The relationship is configured as follows (nothing is in the Insert Callback field):

Metrics Relationship.jpg

2. The metric_instance table is accessible from all application scopes, so I think that is good.

3. On the Related List table, I navigate to the Incident - Metrics entry. In that record is a Related List Entry shown below. I have not been able to figure out what that sysid is on the related list entry. I believe this is where I'm getting help up on having this list show up on other forms.

Related List Entry.jpg

I have tried replicating this Related List Entry for the desired tables but it does not work with that same sysid, REL:412b7b420a258102002a5fdbfab70593, and because I don't what the sysid is actually for I can't fully replicate it. Screen shot of the Related List Entry is below.

related_list_entry.jpg

Any help on this would be greatly appreciated!

1 ACCEPTED SOLUTION

shruti_tyagi
ServiceNow Employee
ServiceNow Employee

Hi Michael,



This id is a sys_id of the record in relationship (sys_relationship) table, in this case its pointing to Metrics relationship. I think the table that has record in Metric Definition table will have Metrics in Related List.



In your first screenshot, Apply to script is:


var gr = new GlideRecord('metric_definition');


gr.addQuery('table', table_name);


gr.addActiveQuery();


gr.query();


answer = gr.hasNext();



Which means Metrics relationship will be available for any tables that has record in metric_definition table. The table you are trying to get Metrics on, did you checked if that table has any record in metric_definition table.



I just tested it by creating one record for Requested Item in metric_definition table and Metrics is available as Related list in sc_req_item table now.



Hope this helps.


View solution in original post

1 REPLY 1

shruti_tyagi
ServiceNow Employee
ServiceNow Employee

Hi Michael,



This id is a sys_id of the record in relationship (sys_relationship) table, in this case its pointing to Metrics relationship. I think the table that has record in Metric Definition table will have Metrics in Related List.



In your first screenshot, Apply to script is:


var gr = new GlideRecord('metric_definition');


gr.addQuery('table', table_name);


gr.addActiveQuery();


gr.query();


answer = gr.hasNext();



Which means Metrics relationship will be available for any tables that has record in metric_definition table. The table you are trying to get Metrics on, did you checked if that table has any record in metric_definition table.



I just tested it by creating one record for Requested Item in metric_definition table and Metrics is available as Related list in sc_req_item table now.



Hope this helps.