Display the project name on Time sheet portal

NiKhil70
Kilo Guru

Hello ,

I have a requirement to show Project Name or Number along with the project task in Time sheet portal under All Tasks.

Time sheet Portal - > All Tasks - > Project Tasks , we see 2 Project Tasks below ( PRJTASK0010746 & PRJTASK0010756 )  but we are not able to identify which project it belongs to , so we want to show the project details as well  along with project tasks.

How can we achieve this ?

find_real_file.png

Thanks & Regards ,

Nilesh .

1 ACCEPTED SOLUTION

Hi Nilesh,

Better to wait for Paris release. This changes is in timecard-task-selector widget and this gets many updates in subsequent release.

Still, I shared below quick fix to show Parent (i.e. Project for pm_project_task and Demand for dmn_demand_task) beside present task link in task selector card.

In timecard-task-selector widget

1. Server script ->

search for 

if(gr.instanceOf('pm_project'))
  record.quickAdd.showProjectCategory = true;

add below code after this if block

if (gr.instanceOf('pm_project_task') || gr.instanceOf('dmn_demand_task')) {
 var parentRecord = '';
 var parentDisplayValue = '';

 var sysClassName = gr.getValue('sys_class_name');
 var taskGr = new GlideRecord(sysClassName);
 taskGr.get(gr.getValue('sys_id'));
 if (gr.instanceOf('pm_project_task'))
   parentRecord = taskGr.sub_tree_root;
 else if (gr.instanceOf('dmn_demand_task'))
   parentRecord = taskGr.parent;
 if (!gs.nil(parentRecord) && !gs.nil(parentRecord.sys_class_name)) {
   parentDisplayValue = '' + parentRecord.short_description;
 }

 record.parent = parentDisplayValue;
 record.display_fields += ',parent'; 
}

 

2. In Body HTML template ->

search for

<a class="card-navigator

add below line after this <a> tag

 <span class="card-navigator pull-left" style="padding-left: 10px;">{{::card.parent}}</span>

You can update the design, as per your requirement.

3. Save.

 

This change will update the task selector card as attached image.

 

Hope, this helps you. 

View solution in original post

6 REPLIES 6

Jayarnab Saha
ServiceNow Employee
ServiceNow Employee

Hi NR,

 

This feature will be available OOB in Paris. We have updated the design of this cards of Task selector, to accommodate parent Project name (as a link to platform form) of which this task belongs.

In which release, you are in? 

 

Regards,

Jayarnab

Hi Jararnab,

Thanks for the quick response .

Now we are in Newyork version, you mean to say that we need to wait until Paris ?

Thanks ,

Nilesh

Hi Nilesh,

Better to wait for Paris release. This changes is in timecard-task-selector widget and this gets many updates in subsequent release.

Still, I shared below quick fix to show Parent (i.e. Project for pm_project_task and Demand for dmn_demand_task) beside present task link in task selector card.

In timecard-task-selector widget

1. Server script ->

search for 

if(gr.instanceOf('pm_project'))
  record.quickAdd.showProjectCategory = true;

add below code after this if block

if (gr.instanceOf('pm_project_task') || gr.instanceOf('dmn_demand_task')) {
 var parentRecord = '';
 var parentDisplayValue = '';

 var sysClassName = gr.getValue('sys_class_name');
 var taskGr = new GlideRecord(sysClassName);
 taskGr.get(gr.getValue('sys_id'));
 if (gr.instanceOf('pm_project_task'))
   parentRecord = taskGr.sub_tree_root;
 else if (gr.instanceOf('dmn_demand_task'))
   parentRecord = taskGr.parent;
 if (!gs.nil(parentRecord) && !gs.nil(parentRecord.sys_class_name)) {
   parentDisplayValue = '' + parentRecord.short_description;
 }

 record.parent = parentDisplayValue;
 record.display_fields += ',parent'; 
}

 

2. In Body HTML template ->

search for

<a class="card-navigator

add below line after this <a> tag

 <span class="card-navigator pull-left" style="padding-left: 10px;">{{::card.parent}}</span>

You can update the design, as per your requirement.

3. Save.

 

This change will update the task selector card as attached image.

 

Hope, this helps you. 

Explanation and code worked flawlessly in Orlando.  Thank you!