Sunday, March 2, 2014

Importing Change Record (with Activity) to Service Manager 2012 using CSV

A recent project that I actively involve, require us to import their existing Change Record (CR) into SCSM 2012 SP1. Like some the organisation out there, the IT department has to retain these information for reference and auditing purposes. Instead of keeping this information (in Excel spreadsheet), it is always good to have this to put into once place. So how do we achieve that ?

If you come across my previous blog on Importing Data (Incident Record) to Service Manager 2012 using CSV - Part 1, then you should have have an idea on
1. SCSM Projection
2. SCSM Type of Class
3. Apendix A (file)

The complication with a typical CR is that you have Activity (or sometime nested Activity) to deal with. I am going to show how can we import a CR with single Activity from CSV.
<CSVImportFormat>
    <Projection Type="System.WorkItem.ChangeRequestProjection">
        <Seed>
            <Class Type="System.WorkItem.ChangeRequest">
     <Property ID="Id" />
     <Property ID="Reason" />
              <Property ID="Notes" />
              <Property ID="Status" />
              <Property ID="Category" />
              <Property ID="Priority" />
              <Property ID="Impact" />
              <Property ID="Title" />
              <Property ID="Description" />
              <Property ID="CreatedDate" />
              <Property ID="ScheduledStartDate" />
              <Property ID="ScheduledEndDate" />
              <Property ID="ImplementationPlan" />
              <Property ID="RiskAssessmentPlan" />
              <Property ID="BackoutPlan" />
              <Property ID="TestPlan" />
              <Property ID="PostImplementationReview" />
              <Property ID="RequiredByDate" />
              <Property ID="Risk" />
<Property ID="ImplementationResults" />
              <Property ID="Area" />
              <Property ID="ContactMethod" />
              <Property ID="ActualStartDate" />
              <Property ID="ActualEndDate" />
              <Property ID="TemplateId" />
              <Property ID="DisplayName" />
            </Class>
          </Seed>
     

<Component Alias="AssignedTo" Count="1">
        <Seed>
          <Class Type="System.Domain.User">
            <Property ID="UserName" />
            <Property ID="Domain" />
          </Class>
        </Seed>
</Component>

<Component Alias="Activity" Count="1">
        <Seed>
<Class Type="System.WorkItem.Activity.ManualActivity">
<Property ID="Id" />
<Property ID="Status" />
<Property ID="Title" />
</Class>
        </Seed>
</Component>

    </Projection>
</CSVImportFormat>


2. Prepare the CSV using excel
I always colored code the SCSM Projection for easy identifying of what information needed.

Take note the Activity that to be imported (YELLOW section), it must match the structure in the coding as be in the coding stated above:
<Component Alias="Activity" Count="1">
<Seed>
<Class Type="System.WorkItem.Activity.ManualActivity">
<Property ID="Id" />
<Property ID="Status" />
<Property ID="Title" />
</Class>
</Seed>
</Component>

3. Ready to import
Both the XML and CSV file are ready to be imported



4. Here you go, this is how does it looks like

No comments: