Archive for: ‘May 2011’

Minor SSP modifications, part 2 – Changing the default urgency of an incident

May 8, 2011 Posted by Anders Asp

Part 1 – Preperations: http://www.scsm.se/?p=398

Disclaimer: I’m not a developer and this is all new to me as well. All code is provided “as is” and I do not give any warranties or take any responsible for any errors that might occur.

So in this post we’re going to do our first modifications to the SSP, and the goal of todays post will be to change the default value of the urgency dropdown to Low (the defualt out-of-the-box value is Medium).

  1. Start Visual Studio and open the Portal.sln that was extracted from the PortalSource-New.zip in step 5 in Part 1 of the series.
  2. Next we need to locate the file in which the code related to this dropdown is stored. With the help of the documentation that was bundled with the source code (System Center Service Manager 2010 Custom Portal Development.docx), I managed to figure out that it is stored in the file named CreateRequest.cs.
  3. So browse the Solution Explorer on your right hand side of Visual Studio for CreateRequest.cs. It should be located at WebParts/Request/CreateRequest.cs. When you found the file, double click it to open it up.
  4. Most of the code related to the “Create Other Request” wizard is located in this file. Unfortunately there is more than 2600 lines of code in this file, so what should we do to find the part regarding the urgency dropdown? Let’s start with searching for the word “Urgency” (Hit Ctrl+F to open up the search window). Our first search should bring you to a line of code that says:
    private Label urgencyHeaderLabel;

    This is the declaration of a variable that seems to be the label of the Urgency part of the wizard. But what’s more interesting, is the line below:

    private DropDownList urgencyDropDownList;

    Great! Now we found the declaration of what looks like the dropdown menu of Urgency. Now let’s continue to search, but this time search for “urgencyDropDownList” instead.Our first hit of  “urgencyDropDownList” is actually where the control itself is added to the wizard. But there’s no hints regarding the default value…It turns out, that there’s plenty of code regarding the urgencyDropDownList, but continue to search until you hit line 2213 (current line is showed in the bottom right hand corner in the status bar, displayed as “Ln”).

    Now that’s a great hint! Thanks for putting those comments in the code Microsoft! 🙂

  5. Take a look at the picture below. I’ve tried to explain the code within the picture. However, the key part of this modification, is to change the part of the code that says:
    if ((Guid)item[DataItemConstants.Id] == Constants.TroubleTicketUrgencyMediumId)

    Unfortunately,we can’t just replace the Constants.TroubleTicketUrgencyMediumId with Constants.TroubleTicketUrgencyLowId. We need to define Constants.TroubleTicketUrgencyLowId first.

  6. So where and how should we declare this constant? Let’s take a look at how Microsoft have declared TroubleTicketUrgencyMediumId. To do so, click the word “TroubleTicketUrgencyMediumId” once to put your marker on it, then press F12 which will bring you to the definition of this variable.That should take you to the Constants.cs file and to a line that looks like this:
    public static readonly Guid TroubleTicketUrgencyMediumId = new Guid(ManagementPackReferences.SYSTEM_WORKITEM_TROUBLETICKET_URGENCYENUM_MEDIUM_REFERENCE);
     
     

    So the declaration of TroubleTicketUrgencyMediumId is done here, but is referenced to another constant? Click SYSTEM_WORKITEM_TROUBLETICKET_URGENCYENUM_MEDIUM_REFERENCE to put your marker there, and press F12 to go to the definition…

    public const string SYSTEM_WORKITEM_TROUBLETICKET_URGENCYENUM_HIGH_REFERENCE = "2F8F0747-B6CB-7996-FD4A-84D09743F218";
    public const string SYSTEM_WORKITEM_TROUBLETICKET_URGENCYENUM_LOW_REFERENCE = "725A4CAD-088C-4F55-A845-000DB8872E01";
    public const string SYSTEM_WORKITEM_TROUBLETICKET_URGENCYENUM_MEDIUM_REFERENCE = "02625C30-08C6-4181-B2ED-222FA473280E";

    Aha. In the ManagementPackReferences.cs within the Microsoft.Mom.BuildConstants.dll, the Out-of-the-box GUIDs for the different levels of urgency is stored.

  7. With this knowledge, let’s get back to the Constants.cs file, and add a new constant for Low urgency. Add a new line undernethe line 55, and enter:
    public static readonly Guid TroubleTicketUrgencyLowId = new Guid(ManagementPackReferences.SYSTEM_WORKITEM_TROUBLETICKET_URGENCYENUM_LOW_REFERENCE);
     
     

  8. Now get back to the CreateRequest.cs file and change Constants.TroubleTicketUrgencyMediumId to Constants.TroubleTicketUrgencyLowId on line 2225. This will work because we have defined a value for TroubleTicketUrgencyLowId in the constants.cs file now.
  9. That should be all coding required for this change. So press F6 to build your solution, and make sure that you get Build Succeeded in the lower left hand corner of the screen.
  10. Head to the directory in which the project is stored, and locate the ..\End User Portal\bin folder. In that folder, find and copy all .DLL files that was updated when you built your solution.
  11. Now head to the SCMS SSP server, and paste those .DLL files in the C:\inetpub\wwwroot\System Center Service Manager Portal\Customized_EndUser\Bin directory. You will get prompted with a question asking if you would like to overwrite the current .DLLs, answer Yes.
  12. Open Internet Explorer and browse to your Customized_EndUser. Click the “Create Other Request” button followed by Next. Step 2 of the wizard should now be displayed, and so should the Urgency dropdown. The default value should now be set to Low.
  13. And that’s it! We are done for today 🙂

I’d love any comments regarding this. Is these types of articles helpful? Are they too easy? Too hard? Are there any kind of minor modifications you would like me to post about?



Minor SSP modifications, part 1 – Preperations

May 7, 2011 Posted by Anders Asp

The source code for the Self-service Portal (SSP) has been released for a while and along with the code you got the option to use an upgraded version of the portal. This upgraded version includes a completly new look, a couple of bug fixes and some new features.

Official blogpost regarding the SSP source code can be found here:
http://blogs.technet.com/b/servicemanager/archive/2011/03/02/service-manager-portal-source-code-released.aspx

That is all great, but there might still be some minor things that you want to change with the portal, and that’s why I’m starting this series of blogposts regarding minor modifications of the SSP. Before we start, I just want to add a disclaimer: I’m not a developer and this is all new to me. All code is provided “as is” and I do not give any warranties or take any responsible for any errors that might occur.

Before I start this series of blogposts “for real”, we need to make sure that you have made any preperations required to follow the serie.

1. Install Visual Studio (I will be using Visual Studio 2010 in this serie)
2. Download the SSP source code and extract the files (http://www.microsoft.com/downloads/en/details.aspx?FamilyID=65fbe0a3-1928-469f-b941-146d27aa6bac&displaylang=en)
3. Since we will be working with the upgraded version of the portal, we need to deploy it into our test/lab/development environment.
3.1. Locate the zip-file containing the updated SSP (..\SCSM2010SP1PORTALSOURCERELEASE\NewExamplePortal.zip) and extract the files.
3.2 Browse the extracted files and rename the EndUser folder to Customized_EndUser and Analyst to Customized_Analyst.
3.3 Copy Customized_EndUser and Customized_Analyst to %systemDrive%\inetpub\wwwroot\System Center Service Manager Portal\ on your SSP server in your test/lab/development environment.

Copy files to SSP

3.4 Open IIS Manager and locate the SCSMPortal. Now, right click the Customized_EndUser folder and choose Convert to application. Repeat for the Customized_Analyst folder.

Convert to application

4. Open Internet Explorer and browse https://<SERVERNAME>/customized_enduser. If everything was done correctly, the updated SSP should now be displayed.

Updated SSP

5. Locate the zip-file containing the source code for the new portal, and extract it (..\SCSM2010SP1PORTALSOURCERELEASE\SourceCode\New\PortalSource-New.zip)
6. Copy the reference binaries listed below from %systemDrive%\inetpub\wwwroot\System Center Service Manager Portal\EndUser\bin\on the SSP server into the ..\SCSM2010SP1PORTALSOURCERELEASE\SourceCode\New\PortalSource-New\Common folder in the Visual Studio solution.  These assemblies can then be used to resolve the VS project assembly references.
– Microsoft.EnterpriseManagement.Config.dll
– Microsoft.EnterpriseManagement.UI.Foundation.dll
– Microsoft.EnterpriseManagement.UI.SdkDataAccess.dll
– Microsoft.Mom.BuildConstants.dll
– Microsoft.EnterpriseManagement.DataAccessService.Core.dll
– Microsoft.EnterpriseManagement.ServiceManager.dll
– Microsoft.EnterpriseManagement.ServiceManager.Portal.Common.dll
7. StartVisual Studio and open the project for the updated SSP. This file should be named Portal.sln and was extracted in step 5.

Visual Studio

7.1 On the right hand side in Visual Studio, you should have something called the Solution Explorer. This is where all the files related to this project is displayed. Some of these files need to be re-loaded and is therefore marked with a yellow exclamation mark. (All of these files should be in the different Reference folders in the Solution Explorer)

Exclamation mark

7.2 Note the name of the file with an exclamation mark, remove it from the project, and add it again. We copied all these files in step 6, so you should be able to find all the files needed on this path: ..\SCSM2010SP1PORTALSOURCERELEASE\SourceCode\New\PortalSource-New\Common. Repeat this step for all files with an exclamation mark.
(Take a look at the screenshot)

Add reference

8. When you’ve finished replacing all the broken references, we are actually finished with all the preparations. But as a final step, lets build our solution to make sure we won’t get any errors before we even got started with the modifications!
8.1 Build your solution by pressing F6 or by clicking Build Solution under Build in the main menu.
8.2 Make sure that “Build succeeded” is displayed in the status bar on the bottom of the left hand side of the screen.

Build

And that’s it. We’ve installed Visual Studio, “installed” the updated SSP and corrected the broken references in the Visual Studio project. We are now ready to begin editing some code!