[SOLVED] Generic Interface - Mapping for incoming request data of a dynamic field

Moderator: crythias

Post Reply
Giulio Soleni
OTRS wizard
Posts: 392
Joined: 30 Dec 2010, 14:35
OTRS Version?: 6.0.x and 5.0.x
Real Name: Giulio Soleni
Company: IKS srl

[SOLVED] Generic Interface - Mapping for incoming request data of a dynamic field

Post by Giulio Soleni »

I have a dropdown dynamic field named AskConfirmation configured with a list of possible key-value pairs
key 00 value Yes
key 01 value No
key 02 value Postponed
key 03 value Delayed

A third-party tool uses the GenericInterface of OTRS as a Provider and calls the TicketCreate method to create a ticket providing the selection for that dyn field, along with the other required info.
So far (OTRS 3.3 is used) the TicketCreate operation is performed using a call like the following example:

Code: Select all

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
                     <Priority>3 normal</Priority>
                     <Body>this is a test</Body>
                     <ContentType>text/plain; charset=utf8</ContentType>
And it works, but I remark that dynamic field value (e.g. Yes) is actually directly passed instead of the key (e.g. 00) for that value.

Updating OTRS to the last available version (at the present moment 6.0.19) the same operation would keep working only if I change the way I set the dynamicField:

Code: Select all

But unfortunately I presently do not have a way to touch the code on the third-party, and I cannot modify the xml SOAP call.
Therefore I thought I might use a map to adjust the received value of for that dyn field when the call is received by OTRS.

I tried the following using Mapping Simple:
However the call keeps failing... :(

Do you have please a hint on how should I manage the mapping of a dynamic field like that, to adapt the incoming call to what OTRS expects?

Thank you very much in advance


I solved using the XSLT mapping with the following filter:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform version="1.0"
    <xsl:output method="xml" encoding="utf-8" indent="yes"/>
	<!-- Copy the original content -->
    <xsl:template match="node()|@*">
            <xsl:apply-templates  select="node()|@*"/>
	<!-- Replace the DynamicField Value of AskConfirmation -->
    <xsl:template match="DynamicField[Name='AskConfirmation']">
                <Name><xsl:value-of select="Name"/></Name>
                    <xsl:when test="Value = 'Yes'">00</xsl:when>
                    <xsl:when test="Value = 'No'">01</xsl:when>
                    <xsl:when test="Value = 'Postponed'">02</xsl:when>
                    <xsl:when test="Value = 'Delayed'">03</xsl:when>
You do not have the required permissions to view the files attached to this post.
OTRS 6.0.x on CentOS 7.x with MariaDB 10.2.x database connected to an Active Directory for Agents and Customers.
ITSM and FAQ modules installed.

Post Reply