Let’s say you are doing some fancy stuff like manually crafting some notifications like this blog post:
…and you want to be able to send the notification to a specific user (or group) using the portion of the rule configuration XML that looks like this:
<WorkflowArrayParameter Name="PrimaryUserList" Type="string">
You need to know the GUID of the user ID to put in the <Item> element.
How do you get that? Well – use SMLets of course!
Here is an easy example:
Get-SCSMObject –Class (Get-SCSMClass –Name System.Domain.User) –Filter “UserName -eq twright” | Format-Table ID, DisplayName
Looks like this:
Then you can just copy the GUID right out of the PowerShell window there!
If you try to do this for a work item object it won’t behave the same way though because there is a System.WorkItem.Id property that is inherited to all work item classes. In order to get the GUID ID in that case you need to do a special trick.
You can use either the Get_ID() method or the PSObject… approach to get at the underlying object and get the GUID of it.