Video Screencast Help

ASDK get assigned policy on a filter?

Created: 22 Apr 2012 | 4 comments

One way or the other, I need to find the assigned policies assigned to a filter/collection so I can update the policy targets.  I would like there to be a cool ASDK way to do it, but if I have to I'll go direct SQL.  I have scowered the ASDK in IIS and can't find any such function.  Did I miss it?  If not, any one know the SQL to find assigned policies? 

This is all for doing software deliver via Workflow.

Thanks in advance!
-Jon

Comments 4 CommentsJump to latest comment

DanGordon's picture

Here's some sample SQL on obtaining the policy-target-filter relationships:

SELECT DISTINCT
  vi1.Guid AS [Filter Guid],
  vi1.Name AS [Filter Name],
  vir.ParentItemGuid AS [Target Guid],
  vi2.Name AS [Target Name],
  rtu.ItemGuid AS [Policy Guid],
  vi3.Name AS [Policy Name]
FROM
  Collection c
  INNER JOIN vItem vi1 ON vi1.Guid = c.Guid
  INNER JOIN vItemReference vir ON vir.ChildItemGuid = c.Guid
    AND Hint = N'resourcetargetfilter'
  INNER JOIN vResourceTargetUses rtu ON rtu.ResourceTargetGuid = vir.ParentItemGuid
  INNER JOIN vItem vi2 ON vi2.Guid = rtu.ResourceTargetGuid
  INNER JOIN vItem vi3 ON vi3.Guid = rtu.ItemGuid

It should work in 7.0 and 7.1.

masonje's picture

That should get me what I need.  Thanks so much!

Zac H's picture

To see all policies assigned to a filter, just go to the filter and click Referenced By.

masonje's picture

I see that, but I need to be able to do this from Workflow.  Thanks though