How do you change the default category listed in worker portal when clicking "add to timesheet"?

Allen Andreas
Administrator
Administrator

Hi all,

So I know how to set the default category when selecting the time card through other ways, but in the worker portal, there are your tasks on the left, within those tasks is an option to "add to timesheet". When you click this, it adds it to your time sheet directly on the right, but the category is "Task work".

We have changed the choices and don't want to use "Task work".

 

I've gone in to the widget, specifically the Time Grid one and in the client script there's a few references to task_work ...I've changed those out and done some trial and error and can't seem to get my default choice I want (by just literally typing it in place of task_work)...to work correctly.

 

Once I make my changes, you can add the task to your time sheet and the first one moved over has the default category I've specified. However, when you go to add the next one, it basically overwrites that entry on your timesheet with the new task you selected (as if the script is maybe looking for my default category and not allowing more than one of those).

 

I've tried to define my default choice as a variable, I've tried just typing it in there...nothing seems to make it work.

 

Is there somewhere else I need to make the change?

 

Please don't mention the dictionary record for time_card.category and add the default there, please don't suggest a BR, please don't suggest a UI action or client script...none of those work for this. This is like a contextual menu type thing that writes exactly what is put in the script. So it's something I need to change in that.

 

Any ideas?


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
1 ACCEPTED SOLUTION

Add this line to the client controller and check if that works.

spUtil.recordWatch($scope,'time_card','');

 

find_real_file.png


Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

26 REPLIES 26

SanjivMeher
Kilo Patron
Kilo Patron

I think you need to change the widget 'Time Card Portal - Task Selector' as shown below, which actually adds the timecard  when you click Add To Timesheet button.

 

find_real_file.png


Please mark this response as correct or helpful if it assisted you with your question.

Hmm...I don't think I've tried there, what script is that in the widget?

 

I've got all the windows open (checkboxes) and I can't seem to ctrl+F find that line anywhere.

 

Like is that in server script? Client?


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

I see a line like that...I'm on Jakarta by the way:

 

	$scope.addTimecardForTask = function(evt, record, taskId){
		_preventDefault(evt);
		record.loading = true;
		var timecards = [];
		timecards.push({
				task: taskId,
				time_sheet: $scope.data.timesheetId,
				category: 'task_work'
		});

 

and I did change it there, if you're going to say change where it says 'task_work'.

 

Like try changing it, if you don't mind on your end?

 

It'll start to work, but when you go to add another task after the first, it overwrites it.


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

I am on Kingston Patch1.

 

It is in the client controller script of widget Time Card Portal - Task Selector.


Please mark this response as correct or helpful if it assisted you with your question.