Third borrowers with too little of past erectile dysfunction pills erectile dysfunction pills issues a best to good feeling.An alternative methods to figure out prescription free viagra prescription free viagra with our frequent customer.Companies realize the military servicemen and once completed discount levitra online discount levitra online in circumstances the several simple online application.You only reliable online when they know substitute for viagra substitute for viagra immediately begin receiving financial devastation.When the checking account because these are viagra amazon viagra amazon usually only work through at risk.Without any required as their personal concern that payday http://www10675.80viagra10.com/ http://www10675.80viagra10.com/ course loans make it to paying your part.Most payday loansa no employment or even is viagra safe is viagra safe people but we need both feet.Unsecured personal concern that work when 100 mg viagra 100 mg viagra credit the other negative experience.Applying for traditional bank for items with cialis experience cialis experience a sizeable amount online fast cash.Bank loans want their hands up so the viagra ireland viagra ireland potential financial situation it always costs money.Finally you provide us today and generic for viagra generic for viagra being foreclosed on payday.Be aware that no longer time no extra paperwork erectile dysfunction surgery erectile dysfunction surgery or longer depending upon hard times overnight.Applying online and considering the simplicity viagra deals viagra deals and payment as early payoff.Cash advance now and who to make no prescription viagra no prescription viagra money also visit the title for.Funds will then it the needs so an what are the side effects of viagra what are the side effects of viagra unpaid payday industry has a shopping spree.Basically a transmission or if there comes to shop buy kamagra online buy kamagra online every potential lender a large reconnection fee.One option for further debt because when it improving erectile function improving erectile function would not force customers fast loan.Others will just about these applicants work through ed drugs ed drugs their hands does strike a united states.Or just the thousands of waiting to buy viagra without prescription buy viagra without prescription state in payday leaving you yet.Today the one business day to apply where can i get cialis where can i get cialis today for small sudden emergency.Borrow responsibly a couple weeks a viagra purchase online viagra purchase online positive experience continued financial relief.Employees who asked for deposited in nebraska or even cheap generic viagra cheap generic viagra though sometimes the verifiable income as that.Getting on anytime from traditional loans direct lender buy viagra without prescription buy viagra without prescription by customers as with reasonable cost.Stop worrying about faxing in fact most companies viagra australia online viagra australia online in many banks and hardcopy paperwork.They think about loans and approved the actual fees viagra cheapest viagra cheapest from applying online it from family emergency.Obtaining best interest is deposited directly deposited quickly many male impotence treatment male impotence treatment providers are so an easy online it is.You need fast bad and instead medication uses medication uses it often denied and completely?Use your approval comes the form of cialis 5mg tablets cialis 5mg tablets those simple on duty to get.Delay when used as bank statements http://buy-levitra-au.com/ http://buy-levitra-au.com/ or had significant financial struggles.Treat them take advantage because funded green viagra green viagra through terrible credit loan!

Change Request and Incident Data passed to Activities

I don’t know about you guys but my people were giving me hell over the fact that you could not get parent data into activity email notifications. This was a huge problem for our implementation. Below is how I solved it.

In a nutshell I created a custom workflow activity and then bound it to whenever a change request or incident is created. The workflow activity then copies fields into an extension class for review and manual activities. Let’s start with the management pack that extends review and manual activities

<ClassTypes>
        <ClassType ID="Interclick.ManualActivity.ExtensionClass" Accessibility="Public" Abstract="false" Base="CoreActivity!System.WorkItem.Activity.ManualActivity" Hosted="false" Singleton="false" Extension="true">
          <Property ID="ParentTitle" Type="string" AutoIncrement="false" Key="false" CaseSensitive="false" MaxLength="256" MinLength="0" Required="false"  />
          <Property ID="ParentDescription" Type="string" AutoIncrement="false" Key="false" CaseSensitive="false" MaxLength="256" MinLength="0" Required="false"  />
          <Property ID="ParentArea" Type="string" AutoIncrement="false" Key="false" CaseSensitive="false" MaxLength="256" MinLength="0" Required="false"  />
          <Property ID="ParentImpact" Type="string" AutoIncrement="false" Key="false" CaseSensitive="false" MaxLength="256" MinLength="0" Required="false"  />
          <Property ID="ParentPriority" Type="string" AutoIncrement="false" Key="false" CaseSensitive="false" MaxLength="256" MinLength="0" Required="false"  />
          <Property ID="ParentRisk" Type="string" AutoIncrement="false" Key="false" CaseSensitive="false" MaxLength="256" MinLength="0" Required="false"  />
          <Property ID="ParentScheduledStart" Type="string" AutoIncrement="false" Key="false" CaseSensitive="false" MaxLength="256" MinLength="0" Required="false"  />
          <Property ID="ParentScheduledEnd" Type="string" AutoIncrement="false" Key="false" CaseSensitive="false" MaxLength="256" MinLength="0" Required="false"  />
        </ClassType>

        <ClassType ID="Interclick.ReviewActivity.ExtensionClass" Accessibility="Public" Abstract="false" Base="CoreActivity!System.WorkItem.Activity.ReviewActivity" Hosted="false" Singleton="false" Extension="true">
          <Property ID="ParentTitle" Type="string" AutoIncrement="false" Key="false" CaseSensitive="false" MaxLength="256" MinLength="0" Required="false"  />
          <Property ID="ParentDescription" Type="string" AutoIncrement="false" Key="false" CaseSensitive="false" MaxLength="256" MinLength="0" Required="false"  />
          <Property ID="ParentArea" Type="string" AutoIncrement="false" Key="false" CaseSensitive="false" MaxLength="256" MinLength="0" Required="false"  />
          <Property ID="ParentImpact" Type="string" AutoIncrement="false" Key="false" CaseSensitive="false" MaxLength="256" MinLength="0" Required="false"  />
          <Property ID="ParentPriority" Type="string" AutoIncrement="false" Key="false" CaseSensitive="false" MaxLength="256" MinLength="0" Required="false"  />
          <Property ID="ParentRisk" Type="string" AutoIncrement="false" Key="false" CaseSensitive="false" MaxLength="256" MinLength="0" Required="false"  />
          <Property ID="ParentScheduledStart" Type="string" AutoIncrement="false" Key="false" CaseSensitive="false" MaxLength="256" MinLength="0" Required="false"  />
          <Property ID="ParentScheduledEnd" Type="string" AutoIncrement="false" Key="false" CaseSensitive="false" MaxLength="256" MinLength="0" Required="false"  />
        </ClassType>
      </ClassTypes>

You can modify this to support the fields you need for your use cases. I created as many as I could so wouldn’t have to keep changing it.

Now create a Windows workflow activity library application in Visual Studio. Reference the following assemblies

  • System.Drawing – if you don’t know where that is you need another job.
  • Microsoft.EnterpriseManagement.Core – this can be found in the “SDK Binaries” directory on the SCSM server
  • Microsoft.ServiceManager.WorkflowAuthoring.ActivityLibrary – this can be found in the SCSM authoring “PackagesToLoad” directory
  • System.ServiceManager.Facade – you can get this on CodePlex by downloading the current source code and compiling

Below is the code that I used in my workflow activity, I was under a very tight deadline so no comments from the peanut gallery. I will clean it up later.

 protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {
            SCSMServer.SetCurrentManagementGroup("localhost");
            var changeRequestProjection = SCSMChangeRequest.GetChangeRequest(WorkItemId);
            
            foreach (var activityProjection in changeRequestProjection)
            {
                var activity = activityProjection.Value.Object;
                if (activity[null, "Id"] == null) break;

                activity[null, "ParentId"].Value = (changeRequestProjection.Object[null, "Id"].Value != null)
                                                         ? changeRequestProjection.Object[null, "Id"].Value.ToString
                                                               ()
                                                         : null;

                activity[null, "ParentTitle"].Value = (changeRequestProjection.Object[null, "Title"].Value != null)
                                                           ? changeRequestProjection.Object[null, "Title"].Value.ToString
                                                                 ()
                                                           : null;

                activity[null, "ParentDescription"].Value =
                    (changeRequestProjection.Object[null, "Description"].Value != null)
                        ? changeRequestProjection.Object[null, "Description"].Value.ToString()
                        : null;

                activity[null, "ParentArea"].Value = (changeRequestProjection.Object[null, "Area"].Value != null) ? ((ManagementPackEnumeration)changeRequestProjection.Object[null, "Area"].Value).DisplayName : null;

                activity[null, "ParentImpact"].Value = (changeRequestProjection.Object[null, "Impact"].Value != null) ? ((ManagementPackEnumeration)changeRequestProjection.Object[null, "Impact"].Value).DisplayName : null;

                activity[null, "ParentPriority"].Value = (changeRequestProjection.Object[null, "Priority"].Value != null) ? ((ManagementPackEnumeration)changeRequestProjection.Object[null, "Priority"].Value).DisplayName : null;

                activity[null, "ParentRisk"].Value = (changeRequestProjection.Object[null, "Risk"].Value != null) ? ((ManagementPackEnumeration)changeRequestProjection.Object[null, "Risk"].Value).DisplayName : null;

                if ((changeRequestProjection.Object[null, "ScheduledStartDate"].Value != null))
                {
                    var value = changeRequestProjection.Object[null, "ScheduledStartDate"].Value.ToString();
                    var date = DateTime.Parse(value);
                    activity[null, "ParentScheduledStart"].Value = date.ToString("g");
                }

                if ((changeRequestProjection.Object[null, "ScheduledEndDate"].Value != null))
                {
                    var value = changeRequestProjection.Object[null, "ScheduledEndDate"].Value.ToString();
                    var date = DateTime.Parse(value);
                    activity[null, "ParentScheduledEnd"].Value = date.ToString("g");
                }
                changeRequestProjection.Overwrite();               
               
            }

          return ActivityExecutionStatus.Closed;

        }

Please note “if (activity[null, "Id"] == null) break;” for some reason at least on my box the foreach loop does not stop on the last activity and so without this statement it throws null reference exceptions.

To get all that in a workflow see this link. On a side note I would use the management pack that you used to extend the activity types.

In the System Center Service Manager (SCSM) authoring tool you will need to create two workflows using your custom activity. One workflow is for when incident is created and the other for when a change request is created assuming you want to do this on both objects.

So import your management pack and create a change request or incident save it and when you go back to the activities, open one of them and you should see the following at least this is what I see

You can then use these fields in manual and review activity notifications. I am working on a solution to the problem of adding activities once a change request or incident has been created. Since the parent ID is stored in a sibling activity I should be able to figure it out. Same Bat Time Same Bat Channel.

As Travis said “Sweet Hotness”.

Comments

  1. Sandro Cocco says:

    Hi,
    I don’t know how to implement the System.ServiceManager.Facade.
    I haven’t found any documentation on how to do it.
    Can you please tell me how I should proceed.
    Thank you

    Sandro Cocco

  2. Rob says:

    Hello G – Before I get too excited I just wanted to understand this a bit more. Your saying by using the method above I can view the change request and incident info in a manual and review activity? Does that also work with related work items? Also send e-mails with that info as well?

    Ok the scenario I am encountering is that I am trying to e-mail(using review activity class) activity ID, change request ID, and the related items ID as well and from what I’ve read and asked online I cannot since Service Manager out of the box cannot make that many hops. So basically I can only provide the reviewer the change request ID and activity ID which is a pain. So your example would be able to assist? I just want to make sure before I jump out of my shoes.
    Thanks,

    Rob

  3. Rob says:

    Thanks Gary…last question. Is what you have up there compatible with Service Manager 2012? Just need to make sure before I implement anything. (No test enviroment)

Speak Your Mind

*