Extending ObjectTemplate in SCSM possible?
is it possible to extend the Objecttemplate class in SCSM like all the other classes in SCSM? We need to filter our Incident and Service Request templates with the sdk functions. But we dont find a good sultion to only show some Incident templates. Now a workaround from us is to use the title property in the template and filter on this value. better would be to create a new property with metadata and filter on that values.
Best Answer
-
Justin_Workman Cireson Support Super IT Monkey ✭✭✭✭✭@Jan_Schulz - I'm sure you probably could extend the Object class to include a new metadata field, but I wouldn't want to go down that path. A better way might be to extend the Incident class and then search for that extension. In powershell I can search for templates based on what properties are used and how they're set. Here I'm checking for a custom enum value:
Get-SCSMObjectTemplate | where {$_.PropertyCollection.MixedValue -eq '2a537dda-f22a-a960-e5f8-bfe7070de55c'}
If you just want to see templates where your property is set you can search on PropertyCollection.Path where Path is the Path to your extension(e.g. $Context/Property[Type='Custom_Class_Extension!ClassExtension_ad8c2ae3_9bef_484d_a80f_988e743e591f']/CustomProperty$)
I hope this helps!6
Answers
Get-SCSMObjectTemplate | where {$_.PropertyCollection.MixedValue -eq '2a537dda-f22a-a960-e5f8-bfe7070de55c'}
If you just want to see templates where your property is set you can search on PropertyCollection.Path where Path is the Path to your extension(e.g. $Context/Property[Type='Custom_Class_Extension!ClassExtension_ad8c2ae3_9bef_484d_a80f_988e743e591f']/CustomProperty$)
I hope this helps!