Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Teamworkx OTRS Integration for Jira also allows a more complex field mapping. This can be useful in the following cases:

  • Map

Table of Contents

Tip

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.:

  • mapping linear values to a nonlinear scale
  • updating Update more than one Jira value based on one OTRS value
  • updating Update one Jira value based on multiple OTRS values

...

To do a complex mapping, functions have to be implemented separately.

Tip

See the demo package under Downloads.

Read the following:

Table of Contents

General Configuration

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

...

Code Block
languageperl
call:Perl::Path::Module,functionName
  • call:The prefix Prefix to tell the mapping it is a function
  • Perl::Path:The Module's Perl Packagepackage
  • Module:The Module odule's name
  • functionName:The name Name of the function to call inside of the Modulemodule

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: An Instance of Kernel::System::TicketJIRA
  2. $fieldmapping: The entries from the SysConfig: TicketJIRA###OTRS-JIRA-FieldMapping
  3. %Ticket: An instance of Kernel::System::Ticket::Article
Code Block
languageperl
my ($TicketJIRAObj, $fieldmapping, %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: An Instance of Kernel::System::TicketJIRA
  2. $val: The value as obtained by the left hand side of the mapping
  3. $fields

    : A Hash of key => values for Jira, e.g.:

    Code Block
    languageperl
    titleExample of fields
     {
    	project       => { key => "ASDF" },
    	issuetype     => { name => "Bug" },
    	summary       => "Title from the Article",
    	description   => "The multi line Body of the Article",
    	reporter      => { name => "Reporter" },
    	assignee      => { name => "Assignee" },
    	customfield_12345  => "Value",
        customfield_12346  => 42,
    }
  4. %Ticket

    : An instance of Kernel::System::Ticket::Article

    Code Block
    languageperl
    my ($TicketJIRAObj, $val, $fields, %Ticket) = @_;

Example Code

Tip

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

This Package package actually makes use of additional settings that are defined in an included XML file.

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

Code Block
languageperl
titleDouglas/Adams/HHGTTG.pm
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 :-)
}