Set Jira Service Desk Organisations

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 Set custom fields using Custom Field Defaults for documentation regarding this feature.

Set a static organisation via Custom Field Defaults

  • Browse to an existing Project Mapping within a JEMH profile and scroll down to the Custom Field Defaults section

  • Press New Custom Field Default to create a new custom field default, then press Edit on the newly created custom field default

  • On the configuration page that follows, select the Organizations custom field within the Custom Field dropdown menu and ensure that the Field Value Type field is set to Simple Text Value.

  • Within the Value field, enter the name of the desired organizasation, you may also define an ID integer if known. You can only supply a single value here, multiple default organisations are currently not supported by JEMH.

  • Define when the default value for the field should apply, either on issue creation, or on issue comment. The Apply Rule field will allow you to configure this behaviour.

  • In the example below, I have defined a default organistion named A and enabled the default value to be applied during Issue Creation and Comment

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.

  • Browse to an existing Project Mapping within a JEMH profile and scroll down to the Custom Field Defaults section

  • Press New Custom Field Default to create a new custom field default, then press Edit on the newly created custom field default

  • On the configuration page that follows, select the Organizations custom field within the Custom Field dropdown menu and ensure that the Field Value Type field is set to Velocity Scripted Value.

  • Within the Value field enter a velocity script similar to the one below:





## 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



  • The example code above extracts the From header of the incoming email and then checks if the address ends with the value thepluginpeople.com, if a match is found the name of the desired organisation is outputted. If no matching From address is found no output will be generated and no organisation will be set.

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