Example of Customer Portal Integration#

You can integrate Allegra into your website. There are two ways to do this: Direct connection of the Allegra server so that your customers can track the progress of their reports directly on your website, or connection via email, without the customer being able to track their items via the website.

Connection with traceability of own items#

In order to submit and query reports, the user must first authenticate. He can register with the system, or simply provide his email address.

After logging in, the user sees the list of his reports, including those closed recently. He can now also submit new reports.

The integration into your own website naturally depends on the CMS used. The design of the user interface also depends on your corporate design and the CMS used.

You can download an example implementation for a website integration from the download workspace. It is based on PHP, JQuery and Bootstrap. The integration into a Contao CMS with support for the German and English language could look like this:

{{iflng::de}} <iframe src="/service-desk/index-de.php" width="100%" height="600px"/> {{iflng}}
{{ifnlng::de}} <iframe src=/service-desk/index-en.php width="100%" height="600px"/> {{ifnlng}}

In the files index-de.php and index-en.php you must specify the address of your Allegra REST interface . You also need to make sure that the web services are active on your Allegra server.

<?php // Insert your server access here
   $SERVER_BASE_URL = "https://www.yourserver.com/track/rest";
   $THEME = "custom"; // [custom | default]
   // Style sheet for custom is in "Resources/custom-style.css"
   // Available locales: en_US, de_DE $PAGE_LANG = "de_DE";
   // Leave path empty if no logo should be shown
   $NAVBAR_COMPANY_LOGO_SRC = ""; ... ``

Connection without traceability of own items#

If it is not necessary for your customers to be able to view the current progress of the items they have submitted at any time via your website, the connection of the Allegra server to your website via email offers the security advantage that you do not have to open an additional system to the outside.

For this, you provide a corresponding contact form, the content of which you then send by email to the appropriate reception address of your Allegra server when submitted by the customer.

It is possible to easily populate data in the Allegra system by formatting the email appropriately. To do this, proceed as follows: Add the following Groovy script with the type “Workflow Activity Script” to the scripts. If you do not use workflows, name the script “EmailActivityScript”. If you integrate the script into workflows, please use a different name, e.g. “EmailWfActivityScript.”``

import java.util.Locale;
import java.util.Map;
import com.aurel.track.beans.TPersonBean;
import com.aurel.track.beans.TWorkItemBean;
import com.aurel.track.fieldType.runtime.base.WorkItemContext;
import com.aurel.track.util.emailHandling.EmailJSONUtil;
import com.aurel.track.admin.customize.scripting.BINDING_PARAMS;

public class EmailActivityScript { // “EmailWfActivityScript” when used in workflows

   public Map<String, Object> handleEvent(Map<String, Object> inputBinding) {
      WorkItemContext workItemContext = (WorkItemContext) inputBinding.get(BINDING_PARAMS.WORKITEM_CONTEXT);
      String body = (String) inputBinding.get(BINDING_PARAMS.EMAIL_BODY);
      if (body == null) {
         return inputBinding;
      }
      TPersonBean senderUser = (TPersonBean) inputBinding.get(BINDING_PARAMS.USER);
      if (senderUser == null) {
         return inputBinding;
      }
      Locale locale = (Locale) inputBinding.get(BINDING_PARAMS.LOCALE);
      String fromAddress = (String) inputBinding.get(BINDING_PARAMS.EMAIL_FROM_ADDRESS);
      if (fromAddress != null && fromAddress.equals("info@yourdomain.com")) { // adjust
         EmailJSONUtil.updateItem(workItemContext, body, senderUser, locale);
      }
      return inputBinding;
   }
}

The body of the email must be a valid JSON object. The attributes of the object will then be the attributes of the new item to be created. Example:

{"AttributeName1":"AttributeValue1", "AttributeName2":"AttributeValue2", "..." }

for example

{
   "Build":"5.2.4",
   "Description":"Some decription of the problem",
   "EndDate":"2017-09-12",
   "ItemType":"Requirement",
   "Manager":"Guest, John",
   "StartDate":"2017-09-10",
   "Status":"analyzed",
   "Synopsis":"Title of problem",
   "Shorttext":"A custom field here",
   "CustomSimpleSelect":"g1",
   "CustomInteger":3,
   "CustomDouble":7.0
}

Use the original attribute names as attribute names. You can use localized attribute names, if the sender of the email (i.e. your website form) is known as a user in your system and has a preferred language set.