Publishing SCSM Request Offerings like an engineer!

Ever had the great idea that you’d create an enumeration list that you’ll use on several RO’s to maximize data quality and ensure successful automation?

I’ve had it. Several times in fact.

However, for obvious reasons I don’t want to relate this enumeration to any class. I want it to be stand-alone and only be used with one or several RO(s). As all “centrally managed lists” I want a change in the list to reflect on all RO(s). And as most of you know you have to map every prompt to a property of a class that is defined in the template related to the RO to be able to publish it.
There’s actually a requirement for this on the data layer and not just in the GUI, which I tought at first.

So how do you map an enumeration that is not a property of any class?

Since all configuration of RO’s are saved in a Management Pack and in XML format we should start by reading the Management Pack XML Schema Reference.
After a few clicks we should notice that the <Extension> element (which contains the RO definition) isn’t documented on MSDN. Thank you very much!

Now we’ll just resort have to resort to reverse engineering, trial and error, logic and creative use of class restrictions. So let’s get started!

If we start by taking a look into how a String prompt is definied:


<Source ControlType="System.SupportingItem.PortalControl.String" Optional="false" ReadOnly="false" ...>
<ControlConfiguration>
<Dependencies/>
<AddressableOutputs>
<AddressableOutput OutputType="string" OutputName="String"/>
</AddressableOutputs>
</ControlConfiguration>
<Targets>
<Target Path="Title" OutputName="String"/>
</Targets>
</Source>

And comparing it to a Enumeration prompt:


<Source ControlType="System.SupportingItem.PortalControl.List" Optional="false" ReadOnly="false" ...>
<ControlConfiguration>
<Dependencies/>
<AddressableOutputs>
<AddressableOutput OutputType="enum" OutputName="ListItem"/>
</AddressableOutputs>
</ControlConfiguration>
<Targets>
<Target Path="Classification" OutputName="ListItem"/>
</Targets>
</Source>

What we’ll want to do is try to map the string value of the enumeration to a string property. So we’ll try to add an AddressableOuput node with a OutputType of String:

<AddressableOutput OutputType="string" OutputName="EnumGuid"/>

And then we’re going to add (or replace) the existing target node with a path to a string property and match the OutputName with the value we used in AddressableOutput:

<Target Path="String0" OutputName="EnumGuid"/>

As a result we’ll end up with something like:


<Source ControlType="System.SupportingItem.PortalControl.List" Optional="false" ReadOnly="false" ...>
<ControlConfiguration>
<Dependencies/>
<AddressableOutputs>
<AddressableOutput OutputType="enum" OutputName="ListItem"/>
<AddressableOutput OutputType="string" OutputName="EnumGuid"/>
</AddressableOutputs>
</ControlConfiguration>
<Targets>
<Target Path="String0" OutputName="EnumGuid"/>
</Targets>
</Source>

Now we can change the Request Offering to status published, increment the version number, save and import the Management Pack!

And in the future we do this with the following Powershell script found at TechNet Gallery!

ForcePublishRequestOffering.ps1

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s