Here’s a tricky one.  How do you get the GUID ID of a work item using SMLets?

First let’s start with getting the GUID ID of a Windows computer object.

We could do something like this:

image

Sweet.  Easy.

What if we did the same thing with a work item?

image

Wait a minute!  That’s not what we expected!

This is happening because the System.WorkItem class from which all other work item classes (Incident, Change request, Problem, Activity, etc) derive from has a property named ID!

So – in this case we need to be a little more clever to get the GUID ID.  This is one way to do it using the Get_ID() method.

image

Another example of how to use this:

image

And of course this works for any kind of object in the system like Windows computers for example:

image