Below will pull up the users and their groups. We decided to stay in group level. Query works in mssql.
SELECT dbo.DWUser.name, dbo.DWGroup.name AS GroupName, dbo.DWGroup.guid, dbo.DWRoles.name AS RoleName
FROM dbo.DWGroup INNER JOIN
dbo.DWUserToGroup ON dbo.DWGroup.gid = dbo.DWUserToGroup.gid INNER JOIN
dbo.DWUser ON dbo.DWUserToGroup.uid = dbo.DWUser.uid INNER JOIN
dbo.DWUserToRole ON dbo.DWUser.uid = dbo.DWUserToRole.uid INNER JOIN
dbo.DWRoles ON dbo.DWUserToRole.rid = dbo.DWRoles.rid
WHERE (dbo.DWGroup.name <> N'Public') AND (dbo.DWRoles.name LIKE 'Plant%')
However workflow does not assign data - external data from my view:
GroupName like 'Plant%' and "G_KW_user = Name (sql command SELECT GroupName FROM Plant_Groups Where GroupName like 'Plant%' and"G_KW_User = name)
The command works in SQL (take out the GV as SQL doesn't know it) but workflow doesn't like it
https://www.docuware.com/sites/default/files/forums-images/Capture1_0.PNG
https://www.docuware.com/sites/default/files/forums-images/Capture2_0.PNG
https://www.docuware.com/sites/default/files/forums-images/Capture3.PNG