Summary

Jira Service Desk supports grouping customers into organisations, an organisation can then be assigned to an issue allowing the members of the organisation to interact with the issue. Organisations in Jira Service Desk can be created on a per-project basis, an organisation may also span across multiple projects. JEMH is capable of setting a default organisation for a created issue either by statically defining a desired organisation, or logically by defining a Velocity script which can be used to determine the desired organisation for a created issue. JEMH can also update an existing organisation value on an issue.

JEMH is currently only capable of setting a single organisation during issue creation and update, this is a limitation of the Jira API and there is no workaround at this time. See JSDSERVER-5483 for more information.

Define a default organisation via JEMH Custom Field Defaults

JEMH can supply default values for issue custom fields during issue creation or issue comment. Custom field defaults are configurable within JEMH Project Mappings, see /wiki/spaces/JEMH/pages/143491123 for documentation regarding this feature.

Set a static organisation via Custom Field Defaults

The result of the above configuration will be that any issue created or commented on via JEMH will have its organisation set to the name defined in the custom field default configuration.

Set a dynamic organisation based on the domain of the email sender

In some cases it may be desirable to automatically create issues from senders of a specific domain with a specific organisation. JEMH Custom Field Default values can be dynamically generated via Velocity scripts. Using a velocity script it is possible to extract the sender address of an incoming email and then use the domain of the address to define an organisation value. For more information on the Velocity template scripting language, see the User Guide.



## Get each internet address in
## the From header of the incoming email
#foreach($addr in $message.getFrom())
## If the address ends with thepluginpeople.com
## output the name of the organisation --> The Plugin People
#if($addr.getAddress().endsWith("thepluginpeople.com"))
The Plugin People
#end
#end


Define an organisation via JEMH Directives

JEMH can update issue custom fields based on the content of an incoming email, this can be achieved via JEMH Field Processors which can parse Directives to update custom field values. An organisation can be set via the Organisations JEMH Directive.

A common way of supplying a JEMH directive is using the @ Prefix Field Processor which allows JEMH directives to be supplied in incoming emails in an @KEY=VALUE format. 

With the @ Prefix Field Processor enabled, an example email to set a service desk organisation during issue creation or comment would look similar to the example below:

MIME-Version: 1.0
Received: by 10.223.112.12 with HTTP; Sat, 18 Jun 2011 22:42:26 -0700 (PDT)
Date: Sun, 19 Jun 2011 17:42:26 +1200
Message-ID: <BANLkTinB1mfSh+GwOXGNWoL4SyDvOpdBoQ@mail.gmail.com>
Subject: Test JSD-68
From: admin@testme.com
To: changeme@thiswontwork.com
Content-Type: text/plain; charset=UTF-8

@Organizations=A