How to retrieve analyst comments from an incident using SCSM commands?
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.
- ActionLog
- CommentLog
Could anyone please throw some inputs on how to retrieve the analyst comment.
Any help is highly appreciated.
Thanks,
Jansi
Answers
Hi @Jansi
Try this:
$irClass = Get-SCSMClass -name System.WorkItem.Incident
$ir = Get-SCSMObject -Class $irClass -Filter "name -eq 'IR1097'"
$relationships = Get-SCSMRelationshipObject -BySource $ir | ?{$_.relationshipid -eq "835a64cd-7d41-10eb-e5e4-365ea2efc2ea"} ##comment log relationship class
foreach ($rel in $relationships) {
$rel.targetobject | select -ExpandProperty values
}