Home Analyst Portal

Is there a way to view the full path for Incident Classification (Category column in Portal)?

Jacky_GrossJacky_Gross Customer Adept IT Monkey ✭✭
The Incident Classification shows by default the last selected value (in Portal as in Console). As we have a detailed hierachy for the classification (in IR and SR), I would like to know if there is any possibility to show the full enumeration list like IT\Software\App1\Funct1 in the portal.
It would be also nice to have the possibility to search (filter) by selecting the parent (containing all the enum list related to the parent) in the Search (Classification contains "").
Thanks.

Best Answer

Answers

  • Conner_WoodConner_Wood Customer Ninja IT Monkey ✭✭✭✭
    edited June 2016
    For the first, it is very possible through code as I've done through C# using the SCSM SDK
    ManagementPackEnumerationCriteria irCategoryListEnumCriteria = new ManagementPackEnumerationCriteria("Name = 'IncidentClassificationEnum'");
    ManagementPackEnumeration irClassificationListEnum = emg.EntityTypes.GetEnumerations(irCategoryListEnumCriteria).ElementAt(0);
    List<ManagementPackEnumeration> incidentClassificationList = emg.EntityTypes.GetChildEnumerations(irClassificationListEnum.Id, TraversalDepth.Recursive).ToList();
    
    
    foreach (ManagementPackEnumeration childEnum in incidentClassificationList)
    {
    	Guid parentId = childEnum.Parent.Id;
    	string DisplayName = childEnum.DisplayName;
    	string FullPathDisplayName = DisplayName;
    	ManagementPackEnumeration currentParent = incidentClassificationList.FirstOrDefault(s => s.Id.Equals(parentId)); //No reason to call server when we already have enums.
    	//While enum doesn't equal root enum or null
    	while (currentParent != null && !currentParent.Id.Equals(irClassificationListEnum.Id))
    	{
    		FullPathDisplayName = currentParent.DisplayName + "\\" + FullPathDisplayName;
    		currentParent = incidentClassificationList.FirstOrDefault(s => s.Id.Equals(currentParent.Parent.Id)); //No reason to call server when we already have enums.
    	}
    	//Show Enum
    	MessageBox.Show(string.Format("Enum={0}\nFull Path={1}", DisplayName, FullPathDisplayName));
    }
    As for the second, it's possible to SQL Query the Child Enum(s) for a particular Parent Enum using CTE Recursion and then you'd have a list of child Ids you could search for.
    WITH CTE_EnumList AS
    (
      SELECT ParentEnum.EnumTypeName, ParentEnum.EnumTypeId, ParentEnum.ParentEnumTypeId 
      FROM [dbo].[EnumType] ParentEnum (nolock) 
      WHERE ParentEnum.EnumTypeName = 'IncidentStatusEnum'
      UNION ALL
      SELECT Enums.EnumTypeName, Enums.EnumTypeId, Enums.ParentEnumTypeId 
      FROM [dbo].[EnumType] Enums (nolock)
      JOIN CTE_EnumList ON Enums.ParentEnumTypeId = CTE_EnumList.EnumTypeId
    )
    SELECT * FROM CTE_EnumList
    OPTION(MAXRECURSION 32767) -- SET TO 0 IF YOU WANT UNLIMITED RECURSION/CHILD DEPTH
  • Jacky_GrossJacky_Gross Customer Adept IT Monkey ✭✭

    Thanks a lot for info. I will try to implement the solutions you proposed and I'll come back.

    For the query I use for the moment the WorkItems cube and it's enough for reporting. I just wanted to implement it in the Cireson Portal for analysts (SEARCH page)

    Best regards.

  • Conner_WoodConner_Wood Customer Ninja IT Monkey ✭✭✭✭

    Add the property ShowPath to your Enum properties and set equal to true.

    EG

    { DataType: "Enum", PropertyDisplayName: "Classification", PropertyName: "Classification", EnumId: '1f77f0ce-9e43-340f-1fd5-b11cc36c9cba', ShowPath: true }
    Oooo, that's very helpful!
  • Robert_OsterbergRobert_Osterberg Customer Advanced IT Monkey ✭✭✭
    Hi Jacky,

    You can do the first part but creating / editing a custom Incident Form. (I'll not going into that as its documented elsewhere but let me know if you need more info). Add the property ShowPath to your Enum properties and set equal to true.

    EG

    { DataType: "Enum", PropertyDisplayName: "Classification", PropertyName: "Classification", EnumId: '1f77f0ce-9e43-340f-1fd5-b11cc36c9cba', ShowPath: true }


    Geoff

    Hi, what other properties are also available on these, is there a list of available properties???
  • Geoff_RossGeoff_Ross Cireson Consultant O.G.
  • Jeremy_WhalenJeremy_Whalen Customer IT Monkey ✭
    edited February 2019
    I'm on 8.3.1.2016 and I've tried this with both Incidents and Changes areas, I see the the full parent/child path when I select the classification but once I click apply and the page refreshes I can only see the final child item.

    On Selection:

    After Apply


    { DataType: "Enum", PropertyDisplayName: "Classification", PropertyName: "Classification", Required: true, EnumId: '1f77f0ce-9e43-aaaa-1fd5-b11cc36c9cba', Showpath: true },
    Edit: My mistake, I should have used ShowPath: true. It works now using the following:
    { DataType: "Enum", PropertyDisplayName: "Classification", PropertyName: "Classification", Required: true, EnumId: '1f77f0ce-9e43-aaaa-1fd5-b11cc36c9cba', ShowPath: true },
  • Sandra_ColeSandra_Cole Customer IT Monkey ✭

    @Geoff_Ross can this be done for SR? I added/edited this line -   { DataType: "Enum", PropertyDisplayName: "Area", PropertyName: "Area", EnumId: "3880594c-dc54-9307-93e4-45a18bb0e9e1",ShowPaht:true}, - but once I refresh/save the SR it reverts back to the last item in the path.


    thanks

  • Geoff_RossGeoff_Ross Cireson Consultant O.G.

    Hi Sandra,

    Should work on SR. Looks like you have a typo in your snippet there. Is that a direct paste? ShowPath

    Geoff

  • Sandra_ColeSandra_Cole Customer IT Monkey ✭

    Geoff,

    That was the issue. Thank you

Sign In or Register to comment.