locked
Get-SCSMObjectProjection doesn't expose all projection components RRS feed

  • Question

  • Hi all,

    just wanted to double check if I'm doing something wrong or if it's really the case, that the Get-SCSMObjectProjection cmdlet (SMlets module) doesn't expose all projection components?

    I'm specifically working currently with the System.WorkItem.Incident.ProjectionType type projection and am interested in the following projection components: AssignedToUser, CreatedByUser, AffectedUser, PrimaryOwner and ResolvedByUser.

    The first three projection components are ok, I can parse them from the object the cmdlet returns. In fact, the AssignedToUser projection component is populated twice (once via the AliasProperty member 'AssignedTo' and  NotesProperty member 'AssignedWorkItem').

    But I can't get the data of the PrimaryOwner and ResolvedByUser projection components... It seems those components are not member of the returned 'EnterpriseManagementObject' object in PowerShell...

    I know I can get this information by working with Get-SCSMRelationshipObject or Get-SCSMRelatedObject cmdlets... But I thought it would be easier working with projections since all the data I'm interested in is already part of the projection and I don't have to run mulitple queries against the SDK to get the data.

    Am I doing something wrong? Is there maybe a "hidden" member to get to the ResolvedByUser and PrimaryOwner component through the ObjectProjection?

    Thanks in advance!

    Cheers

    Alex

    Tuesday, June 25, 2013 2:37 PM

Answers

  • With that typeprojection you could use the endpoint: relatesToIncident to get primary owner and RelatesToTroubleTicket for the ResolvedByUser. Like this:

    Import-Module smlets
    
    $typeproj = Get-SCSMTypeProjection -name System.WorkItem.Incident.ProjectionType
    
    $IRproj = Get-SCSMObjectProjection -ProjectionObject $typeproj -Filter "Id -eq IR2030"  #Replace with your Id
    
    $PrimaryOwner = $IRproj.RelatesToIncident
    
    

    Wednesday, June 26, 2013 9:17 PM

All replies

  • With that typeprojection you could use the endpoint: relatesToIncident to get primary owner and RelatesToTroubleTicket for the ResolvedByUser. Like this:

    Import-Module smlets
    
    $typeproj = Get-SCSMTypeProjection -name System.WorkItem.Incident.ProjectionType
    
    $IRproj = Get-SCSMObjectProjection -ProjectionObject $typeproj -Filter "Id -eq IR2030"  #Replace with your Id
    
    $PrimaryOwner = $IRproj.RelatesToIncident
    
    

    Wednesday, June 26, 2013 9:17 PM
  • Thank you Morten!

    This was it. Weird member names though for those components :)

    Thanks

    Alex

    Thursday, June 27, 2013 9:20 AM