Metric definition should execute based on condition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2024 03:22 AM - edited 01-15-2024 09:18 PM
Hi friends,
I am creating a metric definition to capture a field value "u_enroll_date".
Requirement is that the field change should be captured only when the "state" field changes to "Delivered." For other "state" field values it should not capture the "u_enroll_date".
Code :
var Req = current.state;
if (Req == 'delivered' || Req == 'Delivered') { //// This condition is not working.
createMetric();
}
function createMetric() {
var mi = new MetricInstance(definition, current);
var gr = mi.getNewRecord();
gr.value=current.sys_updated_by;
gr.insert();
}
The Condition in RED above is not working. It is creating record in metric every time the state is changes. It should capture only when the state is Ordered.
How to achieve it through metric script. I cannot add this condition to metric definition business rule since it is required for some other fields as well.
Thank you