List Items (also known as EnumerationValues) are the items that show up in many places in the forms in Service Manager – typically in a drop down control like this one:

image

In most cases you can modify the values that show up in these drop downs by going to the Library/Lists view in the main Service Manager console and using the editor like this:

image

In some cases though you need to add the values in management packs directly.  One example of this is when you need to create an entirely new list.  Another example is when you need to add values to the CI (or Asset) Status list.  We don’t expose that list in the Lists view in the main console so you can’t use the editor in that case.

The way this works is that there is a single “root” EnumerationValue in each list.  It has no Parent attribute.  That EnumerationValue never shows up in the UI anywhere.  It’s children (those EnumerationValue elements that have the parent pointing to it) are the first level items in the drop down.  In this example of CI Status, the root is and first level children are Deployed, Deployment Requested, etc.

This is an excerpt from the System.Library MP which contains the out of box EnumerationValue hierarchy for Asset/CI status:

<EnumerationValue ID="System.ConfigItem.AssetStatusEnum" Accessibility="Public" />

 

<EnumerationValue ID="System.ConfigItem.AssetStatusEnum.Undefined" Accessibility="Public" Parent="System.ConfigItem.AssetStatusEnum" />

<EnumerationValue ID="System.ConfigItem.AssetStatusEnum.PurchaseRequested" Accessibility="Public" Parent="System.ConfigItem.AssetStatusEnum" />

<EnumerationValue ID="System.ConfigItem.AssetStatusEnum.Purchased" Accessibility="Public" Parent="System.ConfigItem.AssetStatusEnum" />

<EnumerationValue ID="System.ConfigItem.AssetStatusEnum.DeploymentRequested" Accessibility="Public" Parent="System.ConfigItem.AssetStatusEnum" />

<EnumerationValue ID="System.ConfigItem.AssetStatusEnum.Deployed" Accessibility="Public" Parent="System.ConfigItem.AssetStatusEnum" />

<EnumerationValue ID="System.ConfigItem.AssetStatusEnum.Retired" Accessibility="Public" Parent="System.ConfigItem.AssetStatusEnum" />

<EnumerationValue ID="System.ConfigItem.AssetStatusEnum.Disposed" Accessibility="Public" Parent="System.ConfigItem.AssetStatusEnum" />

See how each of the first level children point to the “root” EnumerationValue by using the ID of the “root” in the Parent attribute?

 

Now, let’s take a look at how we can add to this list.  Note: Because the above EnumerationValues are in a sealed management pack (System.Library), you cannot edit them.  But – you can add on!

I’ve created a management pack to show how you can add EnumerationValues to existing lists:

<ManagementPack xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ContentReadable="true" SchemaVersion="1.1" OriginalSchemaVersion="1.1">

  <Manifest>

    <Identity>

      <ID>Microsoft.Demo.CIStatus</ID>

      <Version>1.0.0.0</Version>

    </Identity>

    <Name>CI Status</Name>

    <References>     

      <Reference Alias="System">

        <ID>System.Library</ID>

        <Version>7.0.5244.0</Version>

        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>

      </Reference>

    </References>

  </Manifest>

  <TypeDefinitions>

    <EntityTypes>

    <EnumerationTypes>

      <EnumerationValue ID="System.ConfigItem.AssetStatusEnum.Received"

Accessibility="Public"

Parent="System!System.ConfigItem.AssetStatusEnum" />

      <EnumerationValue ID="System.ConfigItem.AssetStatusEnum.Purchased.New"

Accessibility="Public"

Parent="System!System.ConfigItem.AssetStatusEnum.Purchased" />

      <EnumerationValue ID="System.ConfigItem.AssetStatusEnum.Purchased.Used"

Accessibility="Public"

Parent="System!System.ConfigItem.AssetStatusEnum.Purchased" />

    </EnumerationTypes>

    </EntityTypes>

  </TypeDefinitions>

  <LanguagePacks>

    <LanguagePack ID="ENU" IsDefault="true">

      <DisplayStrings>

        <DisplayString ElementID="System.ConfigItem.AssetStatusEnum.Received">

          <Name>Received</Name>

        </DisplayString>

        <DisplayString ElementID="System.ConfigItem.AssetStatusEnum.Purchased.New">

          <Name>Purchased - New</Name>

        </DisplayString>

        <DisplayString ElementID="System.ConfigItem.AssetStatusEnum.Purchased.Used">

          <Name>Purchased - Used</Name>

        </DisplayString>

      </DisplayStrings>

    </LanguagePack>

  </LanguagePacks>

</ManagementPack>

 

Note the language pack section.  That’s what controls the display strings that are shown in the UI for each language.  For more information on localizing management pack content, please see this blog post:

http://blogs.technet.com/servicemanager/archive/2009/07/24/localizing-management-pack-content.aspx

Save this XML as a file called ‘Microsoft.Demo.CIStatus.xml’.

After we import the MP and close and reopen the console, we can see the new options in the Asset Status drop down.

image

The MP is also available here:

http://cid-17faa48294add53f.skydrive.live.com/self.aspx/.Public/CIStatus/Microsoft.Demo.CIStatus.xml