Show business elapsed percentage on incident list view

Khalnayak
Tera Guru

Hi,

I have a requirement to display the Business elapsed percentage field on the incident list view.

the field is related list on the incident table and is from the task sla table.

find_real_file.png

so i have this displayed as a related list within the incident form, but I need this displaying in the list view on incidents like below. so it should bee at the far right displaying the same bar like percentage.

find_real_file.png

How can I achieve this please?

1 ACCEPTED SOLUTION

Hi,

another easy method

1) create reference field on incident table

a) Name - u_task_sla

b) Type - reference

c) Referred to - task_sla

2) Now on the incident list you can dot walk the new field and add the business percentage field via dot walking

3) Remember to populate this new field after insert of task_sla

Condition: current.task.sys_class_name == 'incident'

Script:

(function executeRule(current, previous /*null when async*/) {

    // Add your code here

var inc = new GlideRecord('incident');

inc.get(current.task);

inc.u_task_sla = current.sys_id;

inc.update();

})(current, previous);

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

25 REPLIES 25

Hi,

another easy method

1) create reference field on incident table

a) Name - u_task_sla

b) Type - reference

c) Referred to - task_sla

2) Now on the incident list you can dot walk the new field and add the business percentage field via dot walking

3) Remember to populate this new field after insert of task_sla

Condition: current.task.sys_class_name == 'incident'

Script:

(function executeRule(current, previous /*null when async*/) {

    // Add your code here

var inc = new GlideRecord('incident');

inc.get(current.task);

inc.u_task_sla = current.sys_id;

inc.update();

})(current, previous);

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Ankur,

 

I created a read-only field referencing task_sla table before, and applied the BR to this as below

 

find_real_file.png

it now works but it isnt displaying the business percentage, it is displaying sla definition, how do i change this to display business percentage please

find_real_file.png

 

find_real_file.png

update:

followed your previous instructions and dot walked to the new field and now business percentage is showing! thank you!

However it is still showing the sla definition in the actual incident form, in the new resolution sla field as below

find_real_file.png

 Also, how can I populate the business percentage for incidents that are already existing? as they are currently empty

@Usmaan 

Glad to know that my approach helped.

So the field on list is showing the Business Percentage from Task SLA.

I didn't get the other part

However it is still showing the sla definition in the actual incident form, in the new resolution sla field as below

-> on the form also you will have to configure the form layout and add the dot walked field from that newly created field

Also, how can I populate the business percentage for incidents that are already existing? as they are currently empty

For that you need to write fix script

updateRecords();

function updateRecords(){

var rec = new GlideRecord('task_sla');

rec.addQuery('task.sys_class_name', 'incident');

rec.query();

while(rec.next()){

var inc = rec.task.getRefRecord();

inc.u_new_field = rec.sys_id;

inc.setWorkflow(false);

inc.update();

}

}

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi @Ankur Bawiskar  this is great thank you! I just need help with one more thing, if you need me to raise this as a new question please let me know.

I have added the dot walked field for the workspace view too as I need it showing in Agent Workspace, however, over there it only shows as number, not as percentage and it also doesnt show the percentage bar, see below.

find_real_file.png

1. How can I add percentage bar here? if not, how can I show the % after the numbers?

2.  I need the field to change colour once certain percents are reached (red, amber, green) for example.

I tried highlighted values for workspace, but that only works for the field chosen and since the business elapsed percentage field is dot-walked I cant chose it from the list and hence cannot apply colours to it.

Is there another way i can do this?

find_real_file.png