Need to add a field in the Timesheet portal which links to a table

PaulaaO
Mega Sage

Hi Community,

Wondering if you could help me with something or steer me in the right direction: I need to be able to add a new field in the timesheet portal to allow the user to select a value which links to an existent table.

I've created a new category in the Other tab called "BAU" but the requirement is to somehow make possible for the user to select the cost centre associated with the BAU task, from the Cost Centre list.

Have taken in consideration some possible solutions - not sure if these are the right ones and how I could implement them:

-> create an additional option in "More Actions" : "Add Cost Centre" which would link to the Cost Centre table

-> create an additional column/field but ideally to appear only when BAU is selected, which would link to Cost Centre table

Thank you in advance

Paula

find_real_file.png

1 ACCEPTED SOLUTION

PPM Guy
Giga Contributor

Hi Paula

It is very difficult to add a new field/column to the Time Sheet Portal so that it is Editable. If you would want to attempt such a thing, I would recommend going into the 'tc-grid' ID Widget (sp_widget) and then closely following the implementation of the resource_plan field. That uses a Scripted REST API to get the table data.

Updating More Actions might be more feasible. This can be updated in the 'tcMoreActions' sp_ng_template. Just define a new ng-click and add the behavior to the Client Controller of the 'tc-grid' and mimick the implementation.

 

If you are doing any further customizations in Time Card Management, take a look here for lots of detailed information on how fields are populated or calculated along with heavily detailed commented OOB code for Script Includes, Business Rules, Service Portal Widget Server Scripts, and the Time Sheet Portal's layout. Great for Admins and Developers:

ServiceNow - Time Card Management - Field/Scripting Guide

Wish you luck!

View solution in original post

2 REPLIES 2

PPM Guy
Giga Contributor

Hi Paula

It is very difficult to add a new field/column to the Time Sheet Portal so that it is Editable. If you would want to attempt such a thing, I would recommend going into the 'tc-grid' ID Widget (sp_widget) and then closely following the implementation of the resource_plan field. That uses a Scripted REST API to get the table data.

Updating More Actions might be more feasible. This can be updated in the 'tcMoreActions' sp_ng_template. Just define a new ng-click and add the behavior to the Client Controller of the 'tc-grid' and mimick the implementation.

 

If you are doing any further customizations in Time Card Management, take a look here for lots of detailed information on how fields are populated or calculated along with heavily detailed commented OOB code for Script Includes, Business Rules, Service Portal Widget Server Scripts, and the Time Sheet Portal's layout. Great for Admins and Developers:

ServiceNow - Time Card Management - Field/Scripting Guide

Wish you luck!

Thank you for the advice - I had a go and managed to add a new field in the "More Actions" but didn't get that far to actually make it work, i.e. be able to make that field editable, similar as with Add Note.

 

However, with the help of a colleague we managed to add the separate field as following:

find_real_file.png

What we got stuck at is the scripting bit - we don't know how to make this field to behave as reference so we can allow users to choose the the Cost Center from a table.

If anybody could help would this at all, that would be much appreciated - at least a steer around which script needs amending (is it only the server one?) and the relevant rows where we should look at and replicate.

 

Thank you!!