in Service Manager

How to create a new SCSM object from custom form

I recently had to create a custom form on which I had to place a button to create a new SCSM object. The goal of the form was that one could create a new Phone object directly by clicking a button on a custom Person object form. This may be not a common requirement but is pretty handy if you want to link an object with another one which does not yet exist.

First of all I had to create a button on my custom XAML form and a related Click Event Handler in the code-behind of the form.

I also added a SingleInstancePicker dialog to be able to link my new Phone object to a Person after being created by my New Phone button.

This should then look something like this

New Phone Button

Ok, I got a button on my custom XAML form right beside the SingleInstancePicker dialog. Next I had to add some code for the method createNewPhone() to bring this button to life 🙂

The GUID of the Phone class which is needed to create the necessary ManagementPackClass object can be found by using Powershell

Also the ManagementPackPublicKeyToken is needed to create a ManagementPack object. The PublicKeyToken can be found by using sn.exe

As you see, it is also possible to already add some property values to the newly created Phone object.

Build your new form assembly and add it to your Management Pack Bundle to import to Service Manager. See my previous post on how to add a DLL file to a Management Pack Bundle in Visual Studio.

Et voilà, a click on the new button opens the form for the newly created Phone object.

Hope that helps 🙂

Write a Comment

Comment