We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Metric definition on Risk assessment status field on sn_grc_profile table

avinashdube
Tera Guru

I am trying to create a metric definition on risk assessment status field on the  sn_grc_profile 

The table is in scoped application , i have created the BR and metric definition in scoped application 

Still its not working 


Br code :

(function executeRule(current, previous) {

    if (!current.u_risk_assessment_status.changes()) {
        return;
    }

    var util = new global.MetricEventUtil();
    util.fireMetricEvent(
        current,
        'u_risk_assessment_status',
        current.sys_mod_count
    );

})(current, previous);


var MetricEventUtil = Class.create();
MetricEventUtil.prototype = {

    initialize: function() {},

    fireMetricEvent: function(record, fields, modCount) {
        gs.eventQueue('metric.update', record, fields, modCount);
    },

    type: 'MetricEventUtil'
};metric .png
 
br 1.png


 

 

1 REPLY 1

Naveen20
ServiceNow Employee

Try this Fix — simplify the BR as below

 
javascript
(function executeRule(current, previous) {
    // Replace with the actual field column name from the dictionary
    var fieldName = 'u_risk_assessment_status'; 
    gs.eventQueue('metric.update', current, fieldName, String(current.sys_mod_count));
})(current, previous);