HowTo: Connect OTRS with Alfresco (Part 1)

Robert Ullrich06. Oct 2017 | ConsultingUse cases

Disclaimer:

The practical examples presented in our technical blog (blog.otrs.com) and now in the expert category in our FAQ blog section serve as a source of ideas and documentation to show what is theoretically possible with OTRS in concrete scenarios or sometimes even for more exotic configurations. All configurations presented here were developed under laboratory conditions as a proof of concept. 

We can only guarantee testing and implementation of these concepts to be error-free and productive if implemented in a workshop with one of our OTRS consultants. Without this, the responsibility lies with the customer himself. Please note that configurations from older OTRS versions may not work in the newer ones.

Because I need a new challenge every month, I thought about an integration between OTRS and Alfresco to store documents, which are sent to customers via OTRS, also in Alfresco. I call this integration AlfrescoConnector. Because this integration will become very complex, I’ll split this how-to into several blog articles, which will be released regularly. In this article, I’ll show you how to create, delete sites and how to create, delete folders in Alfresco.

To complete this how-to, you need at first a running OTRS and an Alfresco system. For some operations, you need special privileges in Alfresco (e.g. administrator privileges). The REST/JSON API of Alfresco is activated by default.

Use case for this connector

The AlfrescoConnector can be useful for companies who are sending documents to their customers via OTRS and have to upload them to Alfresco. To improve this workflow and to prevent agents from manually uploading documents to Alfresco, you can use the connector of this article.

OTRS Requirements for this HowTo

OTRS Framework

  • at least OTRS 5.0.x

OTRS Packages

You need the following Freely selectable Features of the OTRS Business Solution5s :

  • OTRSGenericInterfaceInvokerTicket
(Adds new invoker for TicketCreate and TicketUpdate in the GenericInterface.)
  • OTRSGenericInterfaceInvokerEventFilter
(Contains additional functionalities to add conditions to events of invokers.)

Third Party Software

You need this third-party software:

  • XML::Simple
  • XML::LibXML
  • XML::LibXSLT

DynamicFields

  • “AlfrescoSiteID” of type „TEXT“ to store the id of a site (e.g.: 1)
  • “AlfrescoSiteName” of type “TEXT”
  • “AlfrescoSiteVisibility” of type “DROPDOWN” with the following values:
    • PRIVATE: PRIVATE
    • PUBLIC:PUBLIC
  • “AlfrescoFolderName” of type “TEXT”
  • “AlfrescoFolderID” of type “TEXT” to store the id of a folder

Configuring the AlfrescoConnector in OTRS

Now we can start with the configuration. The name of the new web service is “AlfrescoConnector”. Afterwards, you have to set up the needed invokers.

AlfrescoConnector General Configuration

Configuring the Invoker “SiteCreate”

Now you’re ready to start the configuration of the Invokers. At first, we’ll create an Invoker for adding new sites to Alfresco. Set up an Invoker called “SiteCreate” and select all the needed data for your outgoing requests and use “XSLT” as mapping for your outgoing and incoming response data.

AlfrescoConnector Invoker SiteCreate

For the incoming response data, you have to select the dynamic field “SiteID”, which you created before.

AlfrescoConnector Invoker SiteCreate1

Now you can configure your outgoing XSLT-mapping. If you need a working XSLT-mapping, you can use the following example:

AlfrescoConnector Invoker SiteCreate Outgoing Mapping

You also need an XSLT-mapping for the incoming response data, because you have to store the Site ID:

AlfrescoConnector Invoker SiteCreate Incoming Mapping

The used “Event trigger” is the last point for this invoker. Just select one and you’re done with the first Invoker.

Configuring the Invoker “SiteDelete”

The next invoker is “SiteDelete”.  Select all the needed data for your outgoing requests (please don’t forget the dynamic field “AlfrescoSiteID” in the “Ticket dynamic fields” drop-down) and use “XSLT” as a mapping for your outgoing data.

AlfrescoConnector Invoker SiteDelete

As outgoing XSLT-mapping, you can use my example.

AlfrescoConnector Invoker SiteDelete Outgoing Mapping

A mapping for the incoming response data is not necessary because Alfresco sends an empty response.

The used “Event Trigger” is the last point for this Invoker. Just select one and you’re done with the second Invoker. In my example, I’m using a “TicketSubscribe” Event.

AlfrescoConnector Invoker SiteDelete 1

Configuring the Invoker “NodeCreate”

The next Invoker is “NodeCreate”.  Select all the needed data for your outgoing requests and use “XSLT” as a mapping for your outgoing request and incoming response data.

Use my example as outgoing XSLT-mapping:

AlfrescoConnector Invoker NodeCreate Outgoing Mapping

Furthermore, we want to store the NodeID of the response, for that reason we have to use the following mapping for incoming response data:

AlfrescoConnector Invoker NodeCreate Incoming MappingThis mapping stores the NodeID in the dynamic field “AlfrescoFolderID”.

The  “Event trigger” is the last point. Select one and you’re done with the next Invoker.

AlfrescoConnector Invoker NodeCreate General Configuration 1

Configuring the Invoker “NodeDelete”

The next invoker is “NodeDelete”.  Select all the needed data for your outgoing requests (please don’t forget the dynamic field “AlfrescoFolderID” in the “Ticket dynamic fields” drop-down) and use “XSLT” as a mapping for your outgoing data.

Use my example as outgoing XSLT-mapping:

Because the answer is empty if it was successful, you don’t need a mapping for the incoming response data.

The used “Event trigger” is the last point. Select a trigger of your choice and you’re done with the last Invoker of my tutorial.

AlfrescoConnector Invoker NodeDelete General Configuration 1

Configuring the AlfrescoConnector “Network Transport”

Requester configuration

It’s necessary to configure the network transport for the Invokers because we’ve to use the right requests commands towards Alfresco. Otherwise, we’ll receive errors. It’s quite easy as you can see:

AlfrescoConnector Transport_Configuration

Please select “BasicAuth” for authentication and use a valid user.

Afterward just click on “Save and finish”.

Next time

In the next blog article for the AlfrescoConnector, I’ll show you how to create files and additional users in Alfresco.

More information about the Alfresco API

You can also use other resources which are provided by the Alfresco API.

If you need more information, please go to the following website: https://api-explorer.alfresco.com/api-explorer/

#2
Jens Bothe at 25.10.2018, 21:30

The invokers are based on our invoker modul package available for our customers

#1
joz at 19.10.2018, 16:57

Hi, I didnt find OTRSGenericInterfaceInvokerTicket OTRSGenericInterfaceInvokerEventFilter in PackageManager (OTRS 6 Business Solution). The Configuration of a Invoker looks also different in my Version. But I build my invokers myself, maybe I am missing something? Did you build the Invokers yourself or they come with a package? did not see any mentioning in the article so just curious :) btw nice and helpful articles on this blog :)

Your email address will not be published. Required fields are marked *