Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

changing widget in time sheet portal

ammar_k
Tera Expert

Hello,

I am trying to edit a widget in time sheet portal called ( time card grid)

when I add a new column, the drop down menu doesn't work anymore ( see photo )

has anyone tried to change it before ? 

thank you

 

 

3 REPLIES 3

phil_bool_unifi
Tera Guru
Tera Guru

Hey @ammar_k , it might help if you describe what you were hoping to achieve.  That portal widget is pretty complex, with the main container and the grid working closely together, but I have made a number of different enhancements to it over the years.   

The time card grid portal widget uses some directives (bits of reusable code) that may also need changing as you go.  You can see these from the 'Dependencies' and Templates drop down menus in the Widget Editor.

Hello, 
thank you for your reply.
I have changed the server side script to add some fields of the project task table
line 28 : add the fields that i want to display on the grid

var defaultHeaderFields = ['task.short_description','task.top_task.short_description',  'project_time_category', 'task.duration'];

then on line 90, added these fields' labels

'task.short_description' : gs.getMessage('Task'),
		'task.duration': gs.getMessage('Task Duration'),
		'task.top_task.short_description': gs.getMessage('Project Name'),

finally add them to the field array on line 170 : 

data.fields_array = data.fields.concat(['category', 'state', 'task.sys_id', 'task.sys_class_name', 'project_time_category', 'category', 'task.duration', 'task.top_task.short_description']);

 

the fields are added as columns with their data but the drop down menu won't work any more

yogesh41
ServiceNow Employee
ServiceNow Employee

Hi,

If the primary purpose of customising Time Card grid Widgent to include additional columns to grid, then I suggest to explore oob configuration.

 

1. Login as Admin

2. Navigate to All > Service Portal Widget Instance 

3. Open "Time Card Portal Container" record

4. Explore "Additional options, JSON format" attribute to update JSON.

5. Append additional information to tm_grid_options.header_fields ( refer existing config for schema )

 

Attached image for reference.  

 

Service Portal Widget Instance Time Card Portal Container.png

 

Yogesh