Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Filter tasks on time sheet portal group task tab.

Chandler2
Tera Guru

I want to see only particular task type in a particular state to be showing up on time sheet portal Group Tasks Tab.

I found that there is a script include "TimeCardGroupTaskSelector" called in the task selector widget. I tried adding code to the encoded query like ^stateNOT IN3,4 but it didn't work. For example: I only want to see projects which are not in closed state to be showing up here.

find_real_file.png

4 REPLIES 4

Maik Skoddow
Tera Patron
Tera Patron

Hi

if I understand the code of the Script Include right, then at least two types of task are handled there: pm_project & pm_project_task.

In case you are only interested in project tasks where the corresponding project (field top_task) is not in state 3 or 4 then your additional encoded query should look like this

^sys_class_name=pm_project_task^top_task.stateNOT IN3,4

I hope that helps.

Kind regards
Maik

Hi Mike, let me try your suggestion.

Thank you for your response. I'll keep you posted.

Hi Mike,

I tried the encoded code like below but it didn't work.

var encodedQueryForGrpTsks = actualDatesQueryForGrpTsks + plannedDatesQueryForGrpTsks + '^sys_class_name=pm_project^stateNOT IN70,67,58,49,70';

Here I am trying to get the projects which are not in one of these states. It didn't work for me.

But I would like to include demand tasks as well. So I want projects and demand tasks which are not in some particular states. Here project has custom states on pm_project table and demand task has the state value coming from task so no custom state.

 

Any suggestions please.

//if(groupTasks.instanceOf('pm_project') || groupTasks.instanceOf('pm_project_task')){
		
		if(groupTasks.instanceOf('pm_project')){
			var actualDatesQueryForGrpTsks = 'work_startISNOTEMPTY^work_start<=' + weekEndsOnDateTime + '^work_endISEMPTY^ORwork_end>=' + weekStartsOnDateTime + '^assignment_groupIN' + groups.join(',');
			var plannedDatesQueryForGrpTsks =  '^NQwork_startISEMPTY^start_date<=' + weekEndsOnDateTime + '^end_date>=' + weekStartsOnDateTime + '^assignment_groupIN' + groups.join(',');
			var encodedQueryForGrpTsks = actualDatesQueryForGrpTsks + plannedDatesQueryForGrpTsks + '^sys_class_name=pm_project^stateNOT IN59,83,23,36,37';
			
			groupTasks.addEncodedQuery(encodedQueryForGrpTsks);
			
		}
		else
			groupTasks.addEncodedQuery('assignment_groupIN' + groups.join(',')+ '^sys_created_on<='+ weekEndsOnDateTime +'^active=true^ORclosed_atBETWEEN'+ weekStartsOnDateTime +'@'+ weekEndsOnDateTime + '^sys_class_name=dmn_demand_task^stateNOT IN3,4');
		
		groupTasks.query();
		return groupTasks;
	},

    type: 'TimeCardGroupTaskSelector'
};

This is how my code looks like. It works for demand tasks (added the condition in else) but it is not applying filters for Projects.

I am not sure what's missing.