How to find the workgroup associated with a non-project task in the database?
Non-project tasks (also called standard tasks) can be set up at the system, workgroup or global workgroup level. There is a corresponding mapping table for each level:
- SystemLookup
- GlobalWorkgroupLookup
- WorkgroupLookup
To find the workgroup for a non-project task, you must search the mapping table using tableid = '6EA295B6-A667-11D2-80F6-0060975AEC0F'. The code returned is the taskid.
System-level example
select * from standardtask st inner join SystemLookup sl on sl.TableId='6EA295B6-A667-11D2-80F6-0060975AEC0F' and st.taskid=sl.code where st.Deleted=0 order by st.name
Workgroup-level example
select w.name, st.* from standardtask st inner join WorkgroupLookup wl on wl.TableId='6EA295B6-A667-11D2-80F6-0060975AEC0F' and st.taskid=wl.code inner join workgroup w on w.WorkgroupId=wl.WorkgroupId and w.Deleted=0 where st.Deleted=0 order by st.name
The IncludeChildren field of the StandardTask table indicates if the non-project time item is also available to child workgroups.