How we can calculate the engineer's productivity

Jyoti Malhotra
Tera Contributor

Hi Team,

 

How we can calculate the engineer's productivity on incident ticket.

 

In below screen shot User ITIL worked from 11:52:43 to 11:58:05. 

 

I want to calculate the all engineers productivity on ticket.

 

JyotiMalhotra_0-1724049472770.png

 

Thanks

JM

1 ACCEPTED SOLUTION

You can just use the OOB 'assigned_to' metric definition. Copy it and set it to your own field.

Do know that it is very vague what you are trying to accomplish. Assigned_to is an OOB field, doing the same as your custom field. I feel you are creating a lot of technical debt on your instance without a good reason.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

View solution in original post

32 REPLIES 32

Hi @Jyoti Malhotra 

 

You are creating technical debt, better to do this calculation in an excel sheet.

*************************************************************************************************************
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]

****************************************************************************************************************

Hi Atul,

 

It means this requirement not possible via metric script ?

 

Thanks

JM

Hi @Jyoti Malhotra 

 

It is possible,  but to build this script and testing and verification will take more time than it can be done in excel sheet.

 

So avoid scripting.

*************************************************************************************************************
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]

****************************************************************************************************************

Hi Atul,

 

I can understand but we need this in snow.

 

I have tried like this below but its not getting previous user.

 

if (current.u_ticket_handled_by) {

    processMetric();

}

 

 

function processMetric() {

    var previousUser = getPreviousUser();

    if (previousUser) {

        endDuration(previousUser);

    }

    startDuration();

}

 

function getPreviousUser() {

    var prevUser = null;

 

    var gr = new GlideRecord('incident');

    if (gr.get(current.sys_id)) {

        prevUser = gr.getValue('u_ticket_handled_by');

    }

 

    return prevUser;

}

 

function endDuration(previousUser) {

    var gr = new GlideRecord('metric_instance');

    gr.addQuery('definition', '36f789a34700121004b69d2f316d4368');

    gr.addQuery('id', current.sys_id);

    gr.addQuery('value', previousUser); // Query by the previous user's name

    gr.addQuery('calculation_complete', false);

    gr.query();

    if (gr.next()) {

        gr.end = current.sys_updated_on;

        gr.duration = gs.dateDiff(gr.start.getDisplayValue(), gr.end.getDisplayValue(), true);

        gr.calculation_complete = true;

        gr.update();

    }

}

 

 

function startDuration() {

    var mi = new MetricInstance(definition, current);

 

        var gr = mi.getNewRecord();

        gr.start = current.sys_updated_on;

        gr.value = current.u_ticket_handled_by;

        gr.calculation_complete = false;

        gr.insert();

 

}

 after updating the record 1st time  by giving name in u_ticket_handled_by field, this script will run its getting current user which is just now updated with some name in that field.

if we can get previous value, then we can check end duration function update it. otherwise it will create new one.

 

Thanks

JM

 

Hi Atul,

 

JyotiMalhotra_0-1724395537852.png

 

it's not taking end time duration, we need the end field backend value.. so that it will get sorted.

 

Thanks

JM