- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2014 05:48 AM
Hi
I have an issue with my metric definition script.
The metric does not work and I'm not sure if I used the not null condition check correctly, or something else is wrong. Even if a try null, 'NULL', or "NULL" it does not work.
I would like the metric to fire when the u_root_cause_ci field is populated for the first time.
Can anyone help?
if(current.u_root_cause_ci != 'NULL'){
createMatricx(current);
}
function createMatricx(current) {
var mi = new MetricInstance(definition, current);
if (mi.metricExists())
return;
var gr = mi.getNewRecord();
gr.start = current.sys_created_on;
gr.end = current.sys_updated_on;
gr.duration = gs.dateDiff(gr.start.getDisplayValue(), gr.end.getDisplayValue());
// gr.duration = gs.dateDiff(gr.start, gr.end);
gr.calculation_complete = true;
gr.insert();
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2014 06:58 AM
yes, sounds like it try printing what it sees as a value right at the start..
gs.log(current.u_root_cause_ci);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2014 06:58 AM
yes, sounds like it try printing what it sees as a value right at the start..
gs.log(current.u_root_cause_ci);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2014 07:23 AM
Thanks for your help, I found the issue, it's user error on my side... when I created this metric from an existing using insert I did not update the 'Field' value, so you are right that's why the value was not in the log.