Skip Navigation LinksALVAO 10.0ALVAO 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 if a custom tab is defined incorrectly; therefore, always use a copy of the database in the test environment to perform creation and testing.
Warning:
In the tabs you cannot display pages for which displaying in their frame is disabled. Neither in console nor in the WebApp.
Tip:
Creating 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 where ALVAO Service Desk WebService is installed, copy the CodeExtension_Template.cs file in the App_Code folder and rename it according to the content displayed by the tab.

In the newly created file, enter a definition of the new tab into the bordered code block by implementing the IView interface and set the values for the 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 whose libraries are not a component of the CodeExtension_Template.cs 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;
Tip:
If the custom tab should display another page from ALVAO WebApp, use the GetServiceDeskPortalUrl() method from the Service Desk Web Service interface to find the root URL of WebApp. E.g.:
string waUrl = "";
using(HelpdeskWebService ws = new HelpdeskWebService())
{
    waUrl = ws.GetServiceDeskPortalUrl();
}
if (waUrl.Length == 0)
    throw new Exception("WebApp address not set.");

 

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