- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2025 08:50 AM
I created new metric definitions for the sc_task table. I have never created a relationship between tables before. How can I make a 1-to-many relationship between sc_task and metric_instance? Only the metrics that relate to that task and the task ID are in the metric
I want to be able to show the related metrics on a relationship tab on the bottom of the task form.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2025 09:15 AM
Hi @Scott29 ,
To create a related list showing all metrics related to the sc_task record you can do the following.
- Create a new Custom Relationship. System Definition->Relationships (Table Name: sys_relationship)
- Applies to -> sc_task (since you want to show related list on SC Task form)
- Query from -> Metric Table
- Use script section to build you query.
(function refineQuery(current, parent) {
// Add your code here, such as current.addQuery(field, value);
current.addQuery("id",parent.sys_id);
})(current, parent);
- Now in the SC Task from view use "configure related list" and bring you Custom Relationship in the from using slush bucket.
Refer an example in Incident Form:
If my response helped, please mark it helpful and accept the solution so that it benefits future readers.
Regards,
Rohit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2025 09:20 AM
Hi @Scott29 ,
if you have created a metric definition for SC task table
you should be able to see Metrics (just configure the related lists and add metrics)
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2025 11:20 AM
Hi @Scott29 ,
i don’t quite understand your question due to metric and metric definition is to capture previous state or other field change over time. This is not a relationship between tables - so what if that your looking for and what is the business requirement?
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/