Skip to main content
19-Tanzanite
October 9, 2026
Question

SQL Query To Check For User Roles On Open Tasks

  • October 9, 2026
  • 0 replies
  • 4 views

For admins that have access to their SQL database and have ever wondered what roles someone is in for open tasks, here is a SQL query to give you all assigned roles for open CN Tasks.  You can add a where statement for specific users.  I use Metabase and have a variable where I can enter a name.  It is really useful if you need to find a user that has gone on an extended leave or left the company and want to replace them.

 

SELECT
WCAM.WTCHGACTIVITYNUMBER AS "CN Number",
WCA.statestate AS "CN State",
RPM.role AS Role,
WTU.fullName AS "User Name"
FROM WTUser WTU
JOIN RolePrincipalMap RPM
ON RPM.idA3B4 = WTU.idA2A2
JOIN Team TM
ON TM.idA2A2 = RPM.idA3A4
JOIN WTChangeActivity2 WCA
ON WCA.idA3teamId = TM.idA2A2
JOIN WTChangeActivity2Master WCAM
ON WCAM.idA2A2 = WCA.idA3masterReference
WHERE WCA.statestate NOT IN ('RESOLVED','CANCELED')
ORDER BY WCAM.WTCHGACTIVITYNUMBER;