About new-scsmobject and prefix

Nov 15, 2010 at 6:18 PM
Edited Nov 15, 2010 at 6:22 PM

Hi


I try create in some workflow Change Request using new-scsmobject

$class = Get-SCSMClass -Name System.WorkItem.ChangeRequest$

$param=@{Title='SCSMSMlets';Description='Test Desc'}

New-SCSMObject -Class $class -PropertyHashtable $param

And I recieve new Change Request with ID like 1234 without any prefix
How create CR with prefix?

Thanks

regards
Alex

 

Developer
Nov 16, 2010 at 4:56 PM

use the autonumbering capability of the ID property. Try the following:

$param = @{ Title = "SMLets"; Description = "test description"; ID = "MYPREFIX_{0}" }

 

jim

Nov 16, 2010 at 5:29 PM

Thanks
It is work!

Aug 11, 2011 at 1:53 PM

Nice article. The out-of-the-box prefix is "PR", and we are going with that, so we use ID="PR{0}" in the above code with good results.