locked
Additional field on HTML5 portal - @requestEntry["Notes"] RRS feed

  • Question

  • Hello, one day i've looked to the portal and realized a lack of opportunity for end users to see the implementation notes that assigned to user can write while completing SR. You can say that one can write an email notification, but what if someone missed it? The idea to look at resolution of your SR at the portal not bad i think.

    so i've looked at the code in RequestDEtails.cshtml and added code:

    if (requestEntry["Notes"]!= null) 
    				{
    			<div class="page_sub_heading">
    			Analst solution:
    			</div>
    			<div class="text" style="margin-bottom: 3em; white-space: pre-line">
    			@requestEntry["Notes"]
    			</div>
    				}

    And everything works perfect, beside one thing... the incidents! They didn't load because of there is no field like notes for IR.

    In RequestDEtails.cshtml - implementation note is requestEntry["Notes"] for SR

    For incident it is a ResolutionDescription (entity explorer said) and i suppose that i need to write like this:

    requestEntry["ResolutionDescription"] but it doesn't work.

    How to requestEntry ResolutionDescription for IR?

    Monday, December 12, 2016 1:57 PM

Answers

  • Hi Nikolas

    Try this code:

    if (requestEntry.ContainsKey("ResolutionDescription")){
                    <div class="text">
                        <h1>Resolution Description</h1>
                        @requestEntry["ResolutionDescription"]
                    </div>
     }

    ---

    Try our Advanced Self Service Portal for Analyst and End User.

    www.scsmanalystportal.com



    • Edited by Michael Sm Monday, January 23, 2017 8:08 PM
    • Marked as answer by Nikolas Page Tuesday, January 24, 2017 7:42 AM
    Monday, January 23, 2017 8:07 PM
  • Hi Vladimir,

    yes it is possible. Try this code:

    foreach (string listKey in requestEntry.Keys.ToArray()){
      <h1>@listKey</h1>
    }

    ---

    Try our Advanced Self Service Portal for Analyst and End User.

    www.scsmanalystportal.com

    • Marked as answer by Nikolas Page Tuesday, January 24, 2017 7:42 AM
    Monday, January 23, 2017 8:09 PM

All replies

  • +1

    Is there any way to get a list of all objects from requestEntry dictionary?

    Monday, January 23, 2017 4:29 PM
  • Hi Nikolas

    Try this code:

    if (requestEntry.ContainsKey("ResolutionDescription")){
                    <div class="text">
                        <h1>Resolution Description</h1>
                        @requestEntry["ResolutionDescription"]
                    </div>
     }

    ---

    Try our Advanced Self Service Portal for Analyst and End User.

    www.scsmanalystportal.com



    • Edited by Michael Sm Monday, January 23, 2017 8:08 PM
    • Marked as answer by Nikolas Page Tuesday, January 24, 2017 7:42 AM
    Monday, January 23, 2017 8:07 PM
  • Hi Vladimir,

    yes it is possible. Try this code:

    foreach (string listKey in requestEntry.Keys.ToArray()){
      <h1>@listKey</h1>
    }

    ---

    Try our Advanced Self Service Portal for Analyst and End User.

    www.scsmanalystportal.com

    • Marked as answer by Nikolas Page Tuesday, January 24, 2017 7:42 AM
    Monday, January 23, 2017 8:09 PM
  • In the end, we had did it by yourself.

    Add this code after @requestEntry["Description"]  in the RequestDEtails.cshtml

     if (requestEntry["Id"].ToString().Contains("SR"))
                    {
                        if (requestEntry["Notes"] != null)
                        {
                            <div class="page_sub_heading">
                                Analyst comment:
                            </div>
                            <div class="text" style="margin-bottom: 3em; white-space: pre-line">
                                @requestEntry["Notes"]
                            </div>
                        }
                    }
    
                    else if (requestEntry["Id"].ToString().Contains("IR"))
                    {
                        if (requestEntry["ResolutionDescription"] != null)
                        {
                            <div class="page_sub_heading">
                                Analyst comment:
                            </div>
                            <div class="text" style="margin-bottom: 3em; white-space: pre-line">
                                @requestEntry["ResolutionDescription"]
                            </div>
                        }
                    }
                }
    

    This code will shows comment only if it is not empty for SR and IR.

    • Marked as answer by Nikolas Page Tuesday, January 24, 2017 7:32 AM
    • Unmarked as answer by Nikolas Page Tuesday, January 24, 2017 7:33 AM
    Tuesday, January 24, 2017 7:32 AM
  • Thank you all. I have managed to get the description/notes but I also need "Status" and "ResolutionCategory". Is there any way to dump all the enum's of SR's "Status" and IR's "ResolutionCategory"?

    Here is the code if someone needs it

    // Resolution status and description
    	string resultStatusEnum = "";
    	string resultStatus	= "";
    	string resultDescription = "";
    	
    	if (requestEntry["Id"].ToString().Contains("SR"))
    	{
    		try
    		{
    			resultStatusEnum = requestEntry["Status"].ToString();
    			switch(resultStatusEnum)
    			{
    				case "ServiceRequestStatusEnum.Completed":
    					resultStatus = "Riješeno";
    					break;
    				default:
    					resultStatus = resultStatusEnum;
    					break;
    			}
    			
    			resultDescription = requestEntry["Notes"].ToString();
    		}
    		catch
    		{
    			// do nothing
    		}
    	}
    	else if (requestEntry["Id"].ToString().Contains("IR"))
    	{
    		try
    		{
    			resultStatusEnum = requestEntry["ResolutionCategory"].ToString();
    			switch(resultStatusEnum)
    			{
    				case "IncidentResolutionCategoryEnum.Cancelled":
    					resultStatus = "Otkazano";
    					break;
    				default:
    					resultStatus = resultStatusEnum;
    					break;
    			}
    			
    			resultDescription = requestEntry["ResolutionDescription"].ToString();
    		}
    		catch
    		{
    			// do nothing
    		}
    	}
    	else
    	{
    		resultStatus = "";
    		resultDescription = "";
    	}

    Tuesday, January 24, 2017 9:28 AM
  • Vladimir, what do you try to achieve?

    If you need to get display name for the field "Status" field you can use "RequestStatus".

    requestEntry["RequestStatus"]; instead of 

    requestEntry["Status"].ToString();


    -----

    Try our Advanced Self Service Portal for Analyst and End User for SCSM.

    www.scsmanalystportal.com


    • Edited by Michael Sm Tuesday, January 24, 2017 2:43 PM
    Tuesday, January 24, 2017 2:41 PM