For complex mapping, functions have to be implemented separately.

See the demo package under Downloads.

User cases

In case you need the freedom of e.g.:

General configuration

A function can be used either on the left or on the right hand side of the mapping table:

The syntax is as follows:

call:Perl::Path::Module,functionName

Parameters

Left hand side functions

Functions called on the left hand side, the function mapOTRSOptionFieldDemoUser2JIRAAssignee in the screenshot above, will be passed three parameters:

  1. $TicketJIRAObj
  2. $fieldmapping
  3. %Ticket

Right hand side functions

Functions called on the right hand side, the function mapOTRSOptionToJIRAOption in the screenshot above, will be passed four parameters:

  1. $TicketJIRAObj
  2. $val
  3. $fields
  4. %Ticket

Example Code

A Complete example of a installable OTRS Package (OPM) is available at bitbucket.org/cwx/jirademoplugins.

Feel free to explore the examples included therein.

Strictly speaking you can do anything, even just create a value to be send to Jira for a special field.

Mapping Configuration example:

KeyContents
call:Douglas::Adams::HHGTTG,answer
cust:answer

Function example

package call:Douglas::Adams;

use strict;

sub answer {
	my ($TicketJIRAObj, $fieldmapping, %Ticket) = @_; // ignored in this example anyway
	return 42; // this is the only important answer anyway :-)
}