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/">
<env:Header/>
<env:Body>
<TicketCreate>
<UserLogin>myUser</UserLogin>
<Password>myPass</Password>
<Ticket>
<Title>test</Title>
<CustomerUser>myCustomer</CustomerUser>
<Queue>myQueue</Queue>
<StateID>12</StateID>
<ServiceID>42</ServiceID>
<Priority>3 normal</Priority>
<Responsible>myResponsible</Responsible>
</Ticket>
<Article>
<Subject>test</Subject>
<Body>this is a test</Body>
<ContentType>text/plain; charset=utf8</ContentType>
<SenderTypeID>3</SenderTypeID>
</Article>
<DynamicField>
<Name>AskConfirmation</Name>
<Value>Yes</Value>
</DynamicField>
</TicketCreate>
</env:Body>
</env:Envelope>
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
...
<DynamicField>
<Name>AskConfirmation</Name>
<Value>00</Value>
</DynamicField>
...
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
Giulio
EDIT:
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"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:date="http://exslt.org/dates-and-times"
extension-element-prefixes="date">
<xsl:output method="xml" encoding="utf-8" indent="yes"/>
<!-- Copy the original content -->
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<!-- Replace the DynamicField Value of AskConfirmation -->
<xsl:template match="DynamicField[Name='AskConfirmation']">
<DynamicField>
<Name><xsl:value-of select="Name"/></Name>
<Value><xsl:choose>
<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>
<xsl:otherwise></xsl:otherwise>
</xsl:choose></Value>
</DynamicField>
</xsl:template>
</xsl:transform>