SR relationship Powershell Activity in SQL

Hi Team! We have Service Request in this SR are two PowershellActivity(AC) how SR related with AC(PowershellActivity) in database in what table I can see this relationship?


  • Shane_WhiteShane_White Cireson Support Ninja IT Monkey ✭✭✭✭
    Hi @Roman_Nepomniashchii

    Give this a try and let me know if this is what you are after, you need to run this against the ServiceManager DB:

    Select sr.Id_9A505725_E2F2_447F_271B_9B9F4F0D190C AS 'Id', sr.Title_9691DD10_7211_C835_E3E7_6B38AF8B8104 AS 'Title', psa.DisplayName, rt.RelationshipTypeName AS 'Relationship Type Name'
    From Dbo.MT_System$WorkItem$ServiceRequest AS sr
    Join dbo.Relationship AS Rel
    ON sr.BaseManagedEntityId = rel.SourceEntityId
    AND rel.RelationshipTypeId = '2DA498BE-0485-B2B2-D520-6EBD1698E61B'
    Join dbo.MT_Cireson$Powershell$Activity AS psa
    ON psa.BaseManagedEntityId = rel.TargetEntityId
    Join dbo.RelationshipType as rt
    on rt.RelationshipTypeId = Rel.RelationshipTypeId
    Order by cast(stuff(sr.Id_9A505725_E2F2_447F_271B_9B9F4F0D190C,1,2,'') AS int) DESC,  cast(stuff(psa.Id_9A505725_E2F2_447F_271B_9B9F4F0D190C,1,2,'') AS int) DESC

Sign In or Register to comment.