Kindly help me with below requirement
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2025 09:31 AM
Hi Team,
I have below requirement.. there is one custom table call Ldoc in witch there are one field called Milestone with choice list type it is basically works like state field. basically I want to create new field called TAT where I can show the timing of Milestone changing time. please let me know how to do it. kindly find below screen snap for same.
I want to create that field because I want to create report where I will have to capture the Timing.
Thanks & Regards
KP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2025 09:34 AM
Hi @keval3
I am not 100% sure, but will SLA not work for you here?
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2025 09:50 AM
Hi @keval3 ,
If your end goal is to create a report which displays the duration which captures of Milestone field changes, I would suggest to create a Metric Definition on the custom table with below values instead of a new field.
Name : Name of metric
Table : Your custom table
Field : Milestone
Type : Field value duration
This will create a metric instance[metric_instance] whenever there is a change in Milestone value. If this suggestion helps you please accept the solution and mark the answer as helpful.
Thanks,
Gummagatta Harshavardhana
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2025 04:35 AM
Hi Gummagatta
I have created metric and it works but i want ldoc no in my report witch was my custom table no I have created report on Matric table. I wanted to add below things in my report kindly let me know how to do it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2025 09:02 AM
Hi @keval3 ,
To store the Idoc number in the value of metric instance, change the calculation type to script calculation and in the script field add the below script.
Update this line gr.value = current.Idoc.getDisplayValue(); with the field which stores your Idoc number.
If this suggestion helps you please accept the solution and mark the answer as helpful.
createMetric(true);
function createMetric(value) {
var mi = new MetricInstance(definition, current);
var gr = mi.getNewRecord();
gr.start = current.sys_created_on;
gr.end = gs.nowDateTime();
var gdt1 = new GlideDateTime(current.sys_updated_on);
var gdt2 = new GlideDateTime();
gr.duration = gs.dateDiff(gdt1.getDisplayValue(), gdt2.getDisplayValue(), false);
gr.value = current.Idoc.getDisplayValue();
gr.calculation_complete = true;
gr.insert();
}
Thanks,
Harsha Gummagatta