Skip Navigation LinksALVAO 8.2ALVAO Service DeskSystem Implementation in an OrganizationCustom Edits and ExtensionsCustom Program ExtensionsCustom Tabs in Request Detail Skip Navigation Links. Skip Navigation Links Skip Navigation Links.


Custom Tabs in Request Detail

Custom tabs can be used to display custom content in the request detail. It can be custom form within the Service Desk WebApp or e.g. external parametrized link.

Warning:
The ALVAO database can be permanently damaged by the wrong definition of the custom tab, therefore always perform the creation and testing on a copy of the database in the test environment.
Warning:
In the tabs you can not display pages which have the display disabled in their frame. Neither in console nor in the WebApp.
Tip:
Creation of a working custom tab requires good knowledge of the ALVAO database and the Service Desk WebService interface.

Preparing a new custom tab

In the folder with the ALVAO Service Desk WebService installed in the App_Code directory open the CustomViews.cs file.

Into the bordered code block enter a definition of the new command by the IView interface implementation and set the values for id and name properties in the command class constructor.

  • id – tab number (unique)
  • name – tab name displayed in the applications

Example:


class View1 : IView { public int id { get; set; } public string name { get; set; } public View1() { id = 1; name = "Requester address"; } }

Defining the conditions for displaying the custom tab content

In the created tab class, implement the Show method from the IView interface. Input parameters are ticketId (request number) and personId (id of a person who should the tab be displayed to).

Output is then a text string containing URL for displaying on the custom tab. If the URL is empty, the tab is not displayed to the user.

Example:


class View1: IView { … public string Show(SqlConnection Con, SqlTransaction Trans, int ticketId, int personId) { string url = ""; // loading the required data about request from the database using (SqlCommand Cmd = new SqlCommand(@" SELECT ZAA.Street + ' ' + ZAA.City requester_address, liHdTicketHdSectionId, sHdTicketStateNotice FROM tHdTicket HDT JOIN tPerson Z on Z.iPersonId = HDT.liHdTicketUserPersonId JOIN tAccount ZA ON Z.liAccountId = ZA.iAccountId JOIN tAddress ZAA ON ZAA.id = ZA.AddressId WHERE HDT.iHdTicketId = @iHdTicketId", Con, Trans)) { Cmd.Parameters.Add("@iHdTicketId", SqlDbType.Int).Value = ticketId; Cmd.Parameters.Add("@iPersonId", SqlDbType.Int).Value = personId; int sectionId; // of service where the request is string state; // request status string requesterAddress; // requester address (by organization) string solverAddress; // solver address (by organization) using (SqlDataReader ticketReader = Cmd.ExecuteReader()) { if (ticketReader.Read()) { sectionId = int.Parse((ticketReader["liHdTicketHdSectionId"]).ToString()); state = (ticketReader["sHdTicketStateNotice"]).ToString(); requesterAddress = (ticketReader["requester_address"]).ToString(); } else { return url; } } // checking, whether the request is in the requested service, in the “Personal meeting with requester” status if (sectionId == 2 && state == "Personal meeting with requester") { // returned url displays a route on the map from the solver address to the requester address on custom tab WebClient APIClient = new WebClient(); var SAPI = new Uri(HttpUtility.UrlPathEncode("http://maps.google.com/place/query=" + requesterAddress)); APIClient.Encoding = System.Text.Encoding.UTF8; string XMLresponse = APIClient.DownloadString(SAPI); XmlDocument APIresponse = new XmlDocument(); APIresponse.LoadXml(XMLresponse); var APIitems = APIresponse.GetElementsByTagName("item"); if (APIitems.Count >= 1) { var Atributes = APIitems.Item(0).Attributes; var Query = new StringBuilder("q="); Query.Append(requesterAddress); foreach (XmlAttribute Atribute in Atributes) { Query.Append('&'); Query.Append(Atribute.Name); Query.Append('='); Query.Append(Atribute.Value); } url = HttpUtility.UrlPathEncode("http://maps.google.com" + Query.ToString()); } return url; } } return null; } }

Note:
In the example you work with classes, libraries of which are not a component of the CustomView default file. These classes are WebClient, XmlDocument, and StringBuilder. In order to make the example work add these libraries at the beginning of the file:
using System.Net;
using System.Xml;
using System.Text;

 

Did not find what you were looking for? Ask our technical support team.