Cannot delete group
Sometimes when I try and delete a group I get an error:
"This group contains a dependency to a context"
This is telling me that the group is used somewhere. However there are a lot of places where it can be used - roles, field permissions, user/RP fields, event actions, dashboard and workspace permissions. It could be an impossible job to work out exactly where all the dependencies are. Application builder reports can help but only do so much.
Does anyone have a clever way of discovering dependencies?
If you have direct database access to run a query, start by checking the following tables for your group_id:
Sure. For popular groups this output is going to be massive, but here ya go.
'IF OBJECT_ID(''?'') IN (
SELECT DISTINCT OBJECT_ID(t.name)
FROM sys.columns c
JOIN sys.tables t ON t.object_id = c.object_id
WHERE c.name = ''group_id''
AND t.name != ''tblCompanySecurityEvents''
SELECT OBJECT_NAME(OBJECT_ID(''?'')) AS table_name, * FROM ? WHERE group_id = 229
Here is another query. Although, this may require an update to link the Translation tables if you are on 5.5.2+ version.
List contents that groups are attached to:
IF object_id ('tempdb..#groups') IS NOT NULL
DROP TABLE #groups
CREATE TABLE #groups (group_id INT, group_name NVARCHAR(256))
INSERT INTO #groups
( group_id, group_name )
SELECT group_id, group_name
FROM dbo.tblGroup AS g
WHERE group_name IN ('XXX')
SELECT * FROM #groups AS g
SELECT module_name, level_name, field_name, group_name, content_id
FROM dbo.tblModule AS m
JOIN dbo.tblLevel AS l ON m.module_id = l.module_id
JOIN dbo.tblIVFieldDef AS fd ON l.level_id = fd.level_id
JOIN dbo.tblIVGroupContent AS gc ON fd.field_id = gc.field_id
JOIN #groups AS g ON gc.group_id = g.group_id
ORDER BY 1,2,3,5,4
I'm finally getting around to trying this and the output doesn't seem to be helpful. It's not clear to me what application/field/action is being reported using the query in Scotts example. I've replaced the group ID with one from my own environment and queried against a few of the tables mentioned.
The query I provided does not return that information. My query is scanning every table in the Archer database that has a column with name "group_id", to see if it contains a data row where the "group_id" column has the group_id value you specify. If it does, it returns that row. You will not be looking at a "pretty" output, but rather a raw output of the Archer database where you group_id is referenced.
If it returns something from tblXEventActionGroup, then you know that the group is used in a DDE action inclusion/exclusion. Similar for other tables. It does not do the legwork for you of telling you exactly which module/level/field/rule/action/etc to go to in order to resolve the dependency.
Thanks, and this might be a silly question, but does Archer have anything that would provide that information for the group? Otherwise it becomes a sort of needle in the haystack problem.