Home Service Manager

SCSM Program - Reassign Incident Support Group Based On Assigned To

Conner_WoodConner_Wood Customer Ninja IT Monkey ✭✭✭✭
edited October 2016 in Service Manager
Hi all, I believe some people are C# developers on these forums that could benefit from the following program that I've included Source Code with.

In particular, when Searching and Retrieving Results from a Type Projection using the SCSM C# SDK, it's really hard and there's tons of small issues that make it feel impossible.

The issue I encountered was the fact the "Simple Expression" couldn't handle GUIDs and instead I found I had to use the "In".  I did post about this earlier on the technet forums, but I figure it wouldn't hurt to post the answer here as well.



return @"<Criteria xmlns='http://Microsoft.EnterpriseManagement.Core.Criteria/'><Reference Id='" + workItemMP.Name + @"' PublicKeyToken='" + workItemMP.KeyToken + @"' Version='" + workItemMP.Version.ToString() + @"' Alias='WorkItem' />  
			<Reference Id='" + coreIRMP.Name + @"' PublicKeyToken='" + coreIRMP.KeyToken + @"' Version='" + coreIRMP.Version.ToString() + @"' Alias='Incident' />  
			<Expression>
				<In>"
			   + "<GenericProperty Path=\"$Context/Path[Relationship='WorkItem!System.WorkItemAssignedToUser']$\">Id</GenericProperty>" +
				@"<Values>
					<Value>" + "{" + str_scsmUserGUID + "}" + @"</Value>
				  </Values>
				</In>
			</Expression>
		</Criteria>";



Again, Feel free to download and check out the C# Source Code that is included with the program! 

Reassign Incident Support Group Based on Assigned To

Comments

  • Adam_DzyackyAdam_Dzyacky Product Owner Contributor Monkey ✭✭✭✭✭
    Way to rock @Conner_Wood

  • Tom_HendricksTom_Hendricks Customer Super IT Monkey ✭✭✭✭✭
    I can't wait to check this out, @Conner_Wood .  You are doing the community a real service, with this!
  • Conner_WoodConner_Wood Customer Ninja IT Monkey ✭✭✭✭
    Woah, Thanks for the compliments!

    If someone ever needed to tweak the program for Service Requests, they'd mainly need to change some key string values from Incident to Service Request:
    1. IncidentTierQueuesEnum --> ServiceRequestSupportGroupEnum
    2. System.WorkItem.Incident --> System.WorkItem.ServiceRequest
    3. System.WorkItem.Incident.View.ProjectionType --> System.WorkItem.ServiceRequestViewProjection
    4. TierQueue --> SupportGroup

    This is mainly because the Assigned To Relationship is a WorkItem relationship, so both IR and SR reference the same thing because they extend from WorkItem which means less things to tweak.

Sign In or Register to comment.