pass converted value from metric definition to metric instance record
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
The value which is coming from support start date field i wanted to return to metric instance by converting into mm/dd/yyyy format and store it.
6 REPLIES 6
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
// variables available
// current: GlideRecord - target incident
// definition: GlideRecord - (this row)
if (current.u_support_start_date) {
var value = current.u_support_start_date;
var gdt = new GlideDateTime(value);
var fvalue = gdt.getLocalDate().getByFormat("MM/dd/yyyy");
createMetric(fvalue);
}
function createMetric(fvalue) {
var mi = new MetricInstance(definition, current);
if (mi.metricExists())
return;
var gr = mi.getNewRecord();
gr.field_value = fvalue;
gr.field = null;
gr.calculation_complete = true;
gr.insert();
}not working
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
// variables available
// current: GlideRecord - target incident
// definition: GlideRecord - (this row)
if (current.u_support_start_date) {
var value = current.u_support_start_date;
var gdt = new GlideDateTime(value);
var fvalue = gdt.getLocalDate().getByFormat("MM/dd/yyyy");
createMetric(fvalue);
}
function createMetric(fvalue) {
var mi = new MetricInstance(definition, current);
if (mi.metricExists())
return;
var gr = mi.getNewRecord();
gr.field_value = fvalue;
gr.field = null;
gr.calculation_complete = true;
gr.insert();
}not working
