How to retrieve analyst comments from an incident using SCSM commands?

jansi rani krishnan 601 Reputation points
2021-05-10T17:56:54.443+00:00

Hi Team,

I am working on an integration project which requires me to retrieve Incident details using SMLets. I am successful in retrieving other incident details except Analyst comments. There are two relationship class available for

  1. ActionLog
  2. CommentLog

Could anyone please throw some inputs on how to retrieve the analyst comment?

Any help is highly appreciated.

Thanks,

Jansi

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

Accepted answer
  1. Andreas Baumgarten 111.3K Reputation points MVP
    2021-05-10T19:02:35.757+00:00

    Hi @jansi rani krishnan ,

    please try this to get the analyst comments of an incident:

    Import-module SMlets # Import SMLets module  
    $smdefaultserver = "SCSM1" # Define SCSM Management Server  
    $IRid = "IR2031" # Define Incident Record  
    $IRclass=Get-SCSMclass -name System.Workitem.Incident$ # Get SCSM Incident class object  
    $IRobject=Get-SCSMobject -class $IRclass -filter "ID -eq $IRid" # Get IR object  
      
    # Get analyst comments of Incident  
    $relIncidentAnalystComment = Get-SCSMRelationshipClass -Name System.WorkItem.TroubleTicketHasAnalystComment$  
    $AnalystComments = Get-SCSMRelatedObject -SMObject $IRobject -Relationship $relIncidentAnalystComment  
    $AnalystComments | Select *  
    

    If you need the user comments and/or the action log entries as well, this might help:
    https://github.com/abaumgarten42/SCSM_Useful_PSscripts/blob/main/Get-IncidentComments.ps1

    ----------

    (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.