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.

Hide Completed Project Tasks on Time Sheet Portal

Community Alums
Not applicable

Hi,

I have a requirement to hide closed complete project task(which has state=3) on time sheet portal. 

help.png for instance, this task shouldn't appear on all tasks.

Firstly I tried to do it on the time card portal - task selector widget. I edited the function getRecords(table) on server script. Here is the code that I changed: 

 

 

 

var encodedQuery = actualDatesQuery + plannedDatesQuery + '^sys_class_name=pm_project_task^state!=3';
			gr.addEncodedQuery(encodedQuery);
		} else {
			gr.addEncodedQuery('assigned_to=' + data.userId + '^sys_created_on<=' + weekEndsOnDateTime + '^sys_class_name=pm_project_task^state!=3');
			

 

 

 

 As you see, I only added '^sys_class_name=pm_project_task^state!=3' to encodedquery.

It didn't work. I also tried to do it on script include which named TimeCardQueryHelper. I added gr.addQuery('active',true); line to _projectAndProjectTasksQuery and _allTasksQuery function. 

neither that didn't work. If you have any idea, please don't hesitate to share it.

 

Thank you.

 

 

4 REPLIES 4

Samaksh Wani
Giga Sage

Hello @Community Alums 

 

ShrutiW_0-1673936097776.png

 

Go to the Widget, You can make changes in HTML Editor According to your req.

 

Plz Mark my Solution as Accept and Give me thumbs up, if you find it helpful.

 

Regards,

Samaksh

Community Alums
Not applicable

Thank you, I've already found out a mistake in my server script code and fixed it.

Uncle Rob
Kilo Patron

Challenge this requirement.
Most Project Tasks will be closed before Time is entered.
Also... making alterations to the Time Card Portal is a DANGEROUS idea.  The OOB interfaces they give you are not meant to be altered.

Community Alums
Not applicable

Thank you for the warning, Robert! We decided to enter an Actual Time value.