locked
How to display support group name at the portal? RRS feed

  • Question

  • Hello, help me please! I want to display support group name at the portal

    This is not work @requestEntry["SupportGroup"] - it shows internal name according to powershell that start from Enum.944******

    I need displayname field.

    @requestEntry["SupportGroup.Displayname"] not work too. 

    Wednesday, March 22, 2017 4:07 PM

Answers

  • colleague of mine helped me, here is the solution:

    inside c# code in the RequestDetails.cshtml add new string var:

    string customSupportGroup 

    @{

    string customSupportGroup = ((Microsoft.EnterpriseManagement.Configuration.ManagementPackEnumeration)requestEntry["SupportGroup"]).DisplayName;

    }

    Then in HTML body request that var: @customSupportGroup

    I've did it like this 

    <body class="main_body gutters">
        <div class="external">
            @{
                <div class="header">
                    <div class="row">
                        <div class="col span_24 heading">
                            <span>@requestEntry["Id"]:@requestEntry["Title"]</span>
                            <span class="share_this">
                                <span class="icon-Share icon" data-toggle="tooltip" title="@Resources.SelfServicePortalResources.Share"></span>
                            </span>
                        </div>
                    </div>
                    <div class="sub_heading darkgrey-text">@Resources.SelfServicePortalResources.LastUpdated: <span class="utc-date">@DateTime.Parse(requestEntry["LastModifiedDate"].ToString()).ToString("yyyy,M,d,H,m,s")</span></div>
                <div>Assigned to SupportGroup:@customSupportGroup</div>
    			@AssignedToCustom
    			</div>
                <div class="page_sub_heading">
                    @Resources.SelfServicePortalResources.Description
                </div>
                <div class="text" style="margin-bottom: 3em; white-space: pre-line">
                    @requestEntry["Description"]
                </div>

    Also, we've parsed an action log entry and take from it Assigned to User username, so you can display assigned to user in a meanfull way, (no need to expand action log to find assigned user or look for email with notification).

    We have assigned it to var @AssignedToCustom.


    • Edited by Nikolas Page Thursday, March 23, 2017 10:09 AM
    • Marked as answer by Nikolas Page Thursday, March 23, 2017 10:09 AM
    Thursday, March 23, 2017 10:02 AM

All replies

  • colleague of mine helped me, here is the solution:

    inside c# code in the RequestDetails.cshtml add new string var:

    string customSupportGroup 

    @{

    string customSupportGroup = ((Microsoft.EnterpriseManagement.Configuration.ManagementPackEnumeration)requestEntry["SupportGroup"]).DisplayName;

    }

    Then in HTML body request that var: @customSupportGroup

    I've did it like this 

    <body class="main_body gutters">
        <div class="external">
            @{
                <div class="header">
                    <div class="row">
                        <div class="col span_24 heading">
                            <span>@requestEntry["Id"]:@requestEntry["Title"]</span>
                            <span class="share_this">
                                <span class="icon-Share icon" data-toggle="tooltip" title="@Resources.SelfServicePortalResources.Share"></span>
                            </span>
                        </div>
                    </div>
                    <div class="sub_heading darkgrey-text">@Resources.SelfServicePortalResources.LastUpdated: <span class="utc-date">@DateTime.Parse(requestEntry["LastModifiedDate"].ToString()).ToString("yyyy,M,d,H,m,s")</span></div>
                <div>Assigned to SupportGroup:@customSupportGroup</div>
    			@AssignedToCustom
    			</div>
                <div class="page_sub_heading">
                    @Resources.SelfServicePortalResources.Description
                </div>
                <div class="text" style="margin-bottom: 3em; white-space: pre-line">
                    @requestEntry["Description"]
                </div>

    Also, we've parsed an action log entry and take from it Assigned to User username, so you can display assigned to user in a meanfull way, (no need to expand action log to find assigned user or look for email with notification).

    We have assigned it to var @AssignedToCustom.


    • Edited by Nikolas Page Thursday, March 23, 2017 10:09 AM
    • Marked as answer by Nikolas Page Thursday, March 23, 2017 10:09 AM
    Thursday, March 23, 2017 10:02 AM
  • Hi Nikolas, 

    Thank you for providing this info, I am trying to implement it in our environment without much success. 
    When the changes are made and click back onto "My Requests" in the portal you just get a grey spinning wheel.

    Did you add anything else other than the above?

    Thanks

    Ryan 


    Wednesday, May 10, 2017 3:31 PM
  • Hello Ryan. Yeah, it is because of SR's support group is empty.

    We faced with it too and make some modification.

    Add this code at the beginning, after:

        List<Dictionary<string, object>> relatedActivities = ViewBag.RelatedActivites;

    string customSupportGroup = "Support Group not assigned";
    string AssignedToCustom = "Analyst not assigned";
    	if (requestEntry.ContainsKey("SupportGroup") && requestEntry["SupportGroup"] != null)
        {
            customSupportGroup = ((Microsoft.EnterpriseManagement.Configuration.ManagementPackEnumeration)requestEntry["SupportGroup"]).DisplayName;
        }
        if (requestEntry.ContainsKey("AppliesToWorkItem"))
    	{
    		DateTime lmfd = DateTime.MinValue;
        List<object> applies_to = requestEntry["AppliesToWorkItem"] as List<object>;
        foreach (Dictionary<string, object> item in applies_to)
        {
            if (item.ContainsKey("ActionType") && item["ActionType"].ToString() == "System.WorkItem.ActionLogEnum.RecordAssigned")
            {
                if (item.ContainsKey("EnteredBy") && (DateTime)item["EnteredDate"] > lmfd)
                {
                    lmfd = (DateTime)item["EnteredDate"];
                    AssignedToCustom = "Analyst: " + item["Description"].ToString().Split(' ').Last().Split('\\').Last();
    				
                }
            }
        }
    	}

    then call @customSupportGroup.

    Also this script contain custom field AssignedToCustom, that display "Assigned to user". We've took it from Action Log and parce it, but there is one disadvantage for this approach, if you delete analyst and make it blank, at the portal still be displayed Last assigned Analyst, even if field is blank, but when a new analyst will be assigned, he will appear at the portal


    Wednesday, May 10, 2017 3:50 PM