SCSM Incident properties
Hi Team,
I would like to retrieve incident properties and so used the below set of commands.
$IC=get-scsmclass -name system.workitem.incident$
$IC.propertycollection --> this shows only few of the fields
$IC.getproperties("recursive") | add-member -pass noteproperty class $IC --> This command retrieves almost all of the fields for the incident module with few columns as (Name, Key, Required, AutoIncrement, Type and DisplayName)
Similarly, I tried to get the "affecteduser" using Relationship class. I used the below commands. Unfortunately, it did not work.
$RC=get-scsmrelationshipclass -name system.workitemaffecteduser$
$RC.getproperties
$RC.propertycollection
Could anyone please let me know how to retrieve the properties as similar manner for the Incident.
Appreciate your help!!!
Regards,
Jansi
Answers
Hi Jansi,
Get-SCSMClass only gets the class, or abstract representation, of the objects. You need to use Get-SCSMObject and specify the class and if you want a filter. An example:
Get-SCSMObject -class (Get-SCSMClass -name system.workitem.incident$) -filter "DisplayName -eq somevalue"
You can save the class in a variable and use that instead of the get-scsmclass every time as well.
For relationships you have to do something similar with get-SCSMRelationshipClass and Get-SCSMRelationshipObject and then find the source and target objects of the relationship. Or you can use projections if one exists for the data you need.
@Jansi - Are you trying to get the properties of the user class? Or are you trying to view the Affected User on a given incident?
Hi Justin,
I know how to view the Affected user for an incident. I would like to see the property name Vs. Display Name of the user class, File Attachment class.
Example:
PropertyName DisplayName
=========== ==========
AffectedUser Affected User
AssignedTo Assigned To
Regards,
Jansi