Retrieving Incident Id from Manual Activity

jansi rani krishnan 601 Reputation points
2021-07-18T19:03:53.657+00:00

Hi Team,

I have created a Manual Activity for an Incident in SCSM. I need some help in retrieving the Incident Id from the Manual Activity under which it is created.

I tried the below commands for the same.

$MAclass = Get-SCSMclass -name System.Workitem.Activity.ManualActivity$
$MAObj=get-scsmobject -class $MAclass -filter "Id -eq MA6380"

$MAObj | select-object *

I did not find any field to get the Incident Id.

Please help me in figuring out the Incident Id from the Manual Activity.

Regards,
Jansi

Service Manager
Service Manager
A family of System Center products for managing incidents and problems.
232 questions
0 comments No comments
{count} votes

Accepted answer
  1. Andreas Baumgarten 109.9K Reputation points MVP
    2021-07-18T20:15:51.673+00:00

    Hi @jansi rani krishnan ,

    here we go:

    Import-Module SMLets  
    $maID = "MA2114"  
    $MAclass = Get-SCSMclass -name System.Workitem.Activity.ManualActivity$  
    $relWIcontainsActivity = Get-SCSMRelationshipClass -Name System.WorkItemContainsActivity  
    $MAObj=get-scsmobject -class $MAclass -filter "Id -eq $maID"  
    $relatedIR = Get-SCSMRelationshipObject -ByTarget $MAObj  
    $relatedIRobj = Get-SCSMObject -Id ($relatedIR.SourceObject.Id)  
    $relatedIRobj  
    

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.