Share via


SCSM - Fix Error on Delete Service Offering - ManagementPackEnumeration ID was not found

Introduction

If you are getting the following error when you try to delete a service offering: An object of class ManagementPackEnumeration with ID '<GUID>' was not found

Resolution

This error is particular deals with an Enumeration being deleted but it is still being referenced in the Service Offering.This means we have invalid data somewhere in this service offering which is stored as a row in the Live SCSM Database.It's unfortunate that SCSM inadvertently validates all the data of an object it's about to delete, but now it's up to you to make it work once again!

To quickly view the Service Offering data, we're going to use Microsoft SQL Server Management Studio (SSMS).

You'll need to connect to your SCSM SQL Server which hosts your SCSM Live Database, in this instance, let's say "ServiceManager" is the name of the database and our code will reflect this, if your Live SCSM Database is named differently, please alter your SQL Statements accordingly after you copy and paste them into SSMS.

Now that you are connected, open a query, paste in the following code and execute it to see all your Service Offering data.

USE ServiceManager;
SELECT * FROM [dbo].[MTV_System$ServiceOffering] (nolock)

Great, you have all these results returned, but there is alot of info, is there anyway we can make finding the '<GUID>' that needs to be changed?

Luckily there is, click on the empty header cell to select your entire results table.  Now right click on it and choose copy with headers.  Now paste that data into Excel.

You can now [Ctrl + F] to open the Find Window, then paste in the <GUID> that the error mentioned and see which column it corresponds to.

Let's say it finds the <GUID> under the column called Category_FA6F9436_5014_F7B7_CB61_38D3F8202828

Now let's execute another query to see if other Service Offerings also have an invalid Category Enum.

USE ServiceManager;
  
SELECT ServiceOffering.[BaseManagedEntityId]
    ,ServiceOffering.[DisplayName]
    ,ServiceOffering.[Category_FA6F9436_5014_F7B7_CB61_38D3F8202828]
    ,SO_Category.[Category]
FROM [dbo].[MTV_System$ServiceOffering] ServiceOffering (nolock)
  
--Join for getting localized Service Offering Category enumeration
LEFT JOIN
(
  SELECT DISTINCT  Enum.EnumTypeId, LT.LTValue AS 'Category'
  FROM [dbo].[EnumType] Enum (nolock)
  JOIN [dbo].[LocalizedText] LT (nolock)
  ON LT.LanguageCode = 'ENU'
  AND LT.LTStringType = 1 -- 1 is localized DisplayName for the element, 2 is Description
  AND Enum.EnumTypeId = LT.LTStringId
) AS  SO_Category ON  SO_Category.[EnumTypeId] = ServiceOffering.[Category_FA6F9436_5014_F7B7_CB61_38D3F8202828]

If the Category column is showing up as NULL then you know you will have to update those Service Offerings as well.

There're 2 ways you can update the data.

  1. (Unsupported) - Edit the ServiceOffering SQL table directly and delete the invalid Enumeration ID to make the cell NULL OR
  2. (Supported) - Since we can alter this Enumeration in SCSM, we open the Service Offering and notice the Category appears blank, however, we know the truth that the data being stored is not what is shown in SCSM.  So we select a different category and hit OK to save the data.

I can confirm the SCSM code is faulty, if I edit a service offering and remove the category from the combobox and hit OK, it will still retain that Enumeration ID and not set it to NULL... which explains how this error comes about, the Enumeration itself gets removed, but the Service Offerings retain the Enumeration ID which of course no longer exists in the Enumeration Table.... 

Conclusion

The reason I went into detail is if you encounter a variant of this error in regards to deleting a Service Offering, you will be far better off at least knowing where to look.