Reopen tasks

SELECT ars.taskkey AS 'Task ID', CASE WHEN ars.tasktype = 1 THEN 'Add access' WHEN ars.tasktype = 2 AND ars.entitlement_valuekey IS NOT NULL THEN 'Remove access' WHEN ars.tasktype = 2 AND ars.entitlement_valuekey IS NULL THEN 'Remove account' WHEN ars.tasktype = 3 THEN 'New account' WHEN ars.tasktype = 4 THEN 'Role request' WHEN ars.tasktype = 5 THEN 'Change password' WHEN ars.tasktype = 6 THEN 'Enable account' WHEN ars.tasktype = 8 THEN 'Delete account' WHEN ars.tasktype = 9 THEN 'Update user' WHEN ars.tasktype = 12 THEN 'Update account' WHEN ars.tasktype = 14 THEN 'Disable account' WHEN ars.tasktype = 18 THEN 'Create user (From create user tile)' WHEN ars.tasktype = 19 THEN 'Update user (From update user tile)' WHEN ars.tasktype = 24 THEN 'Create entitlement' WHEN ars.tasktype = 25 THEN 'Add access entitlement' WHEN ars.tasktype = 26 THEN 'Remove access entitlement' WHEN ars.tasktype = 27 THEN 'Update entitlement' WHEN ars.tasktype = 28 THEN 'Delete entitlement' ELSE 'Unknown' END AS 'Task Type', CONCAT(reqUser.firstname, ' ', reqUser.lastname, '(', reqUser.username, ')') AS 'User', COALESCE(acc.name, ars.accountname) AS 'Account', CASE WHEN acc.status = 2 THEN 'Inactive' WHEN acc.status = 1 THEN 'Active' WHEN acc.status IS NULL THEN 'Not yet provisioned' ELSE acc.status END AS 'Account Status', ss.systemname AS 'Security System', ep.endpointname AS 'Endpoint', ev.entitlement_value AS 'Entitlement', SUBSTRING_INDEX(arq.jbpmprocessinstanceid, '.', -1) AS 'RequestId', ars.PROVISIONINGTRIES, ars.source, ars.sourceid, ars.taskdate AS 'Creation Date', CASE WHEN ars.status = 2 THEN 'Pending' WHEN ars.status = 1 THEN 'Open' WHEN ars.status = 3 THEN 'Completed' WHEN ars.status = 4 THEN 'Discontinued' WHEN ars.status = 8 THEN 'Error' ELSE 'Unknown' END AS 'Status', CONCAT(updateUser.firstname, ' ', updateUser.lastname, '(', updateUser.username, ')') AS 'Update User', ars.updatedate AS 'Task Updated On', ars.comments AS 'Provisioning Comments', RIGHT(ars.PROVISIONINGCOMMENTS, 270) AS 'Provisioning MetaData' FROM arstasks ars LEFT JOIN users reqUser ON ars.userkey = reqUser.userkey LEFT JOIN users updateUser ON ars.UPADTEUSER = updateUser.userkey LEFT JOIN accounts acc ON ars.accountkey = acc.accountkey LEFT JOIN entitlement_values ev ON ars.entitlement_valuekey = ev.entitlement_valuekey LEFT JOIN endpoints ep ON ars.endpoint = ep.endpointkey LEFT JOIN securitysystems ss ON ars.securitysystem = ss.systemkey LEFT JOIN ars_requests arq ON ars.requestkey = arq.requestkey WHERE (acc.status IS NULL OR acc.status NOT IN ('SUSPENDED FROM IMPORT SERVICE')) AND ars.status = 8 AND ars.PROVISIONINGTRIES > 1 AND ars.taskdate > '2025-05-05'

Comments

Popular posts from this blog

Enhanced Query - To Update Account Status and Name

Connection Config - STATUS_THRESHOLD_CONFIG

Email variables _ Register User