Versions Compared

Key

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

...

Directive Sets are groups of one or more pre-defined Directives that can be triggered by clicking a secure one-time link rendered in an email notification.

...

This is where you specific the Directives that will be used to update the fields you require. This is found within the Notifications tab in JEMH.  You should see a section called Directive Sets.  Select Create.  You will then be taken to the creation screen:

...

Configuration Options

Setting Name

Description

Status

The status that the Directive Set will be saved in.  If set to "disabled", subsequent links generated for the Directive Set will not be processed (but also not consumed).

Name

The name of the Directive Set.  This field is required, in order to help differentiate from others.

Description

A description for the Directive Set can be added.  This allows other administrators to understand its function.

To Address

Enter the address which the directives should be sent to in order to be processed. This should usually be a "catch email address" on the target profile.

Response TemplateSet

Allows selection of a template that will be used to render the response screen that a user is shown when they click on a directive set link. Information on creating these templates.

Directive(s)

The directive content to be executed.  It is recommended to enable the @prefix field processor, and use the respective format.  An example is given when creating each Directive Set.

Notification templates

The DirectiveSetManager can be interacted with as $jemhDirectiveSetLinkManager below, to call createDirectiveSetLink(this comes pre-built into JEMH's global macros, the below code does not need to be added):

...

The Parameters to this are as follows:

Example Variable

Example Value

Description

Code Block
$jemhDefaultDirectiveSetGroupId

8f5f485b-7496-4f4b-a0fc-3e37269704bc

This is an id that is used to relate a set of links, such that when one link is used, the others are inherently expired/voided. An email may have several groups of links.

Code Block
$runAsUserKey

andy

This is the ApplicationUser.getKey() value, e.g. $issue.getReporter().getKey() , the user will be the security context for the execution of the Directives. An email may have links with different context users.

Code Block
$issue

its the issue from the event, $issue

The Issue object the event is about, if you're in a post-function, you'll have to get a reference to start with. The $issue may vary over links.

Code Block
$directiveSetId

10

This integer value must refer a known ID value shown in the Directive Set section of the Notifications page. It refers to the set of Directives that will be applied.

Code Block
$profileId

5

This integer value must refer a known profile ID value shown in the JEMH Profiles page. It will be the profile that will be used for processing the Directive Set defined in $directiveSetId, as the $runAsUserKey on the $issue

Adding Link to Notification

...

Code Block
languagetext
#generateDirectiveSetLink(LABEL,RUN AS USER Key,DIRECTIVE SET ID,PROFILE ID)

Parameter

Type

Description

LABEL

String

The text that will show for the hyperlink in the notification.

RUN AS USER KEY

String

This is Key of a Jira user that the Directives will be sent by. This needs to be a user who is allowed to perform the issue actions that the directive is for.

Here you can use $userManager.getUserByName('admin').getKey() to get the key for a specific user.

DIRECTIVE SET ID

Integer

The ID number of the Directive Set that this link is to be associated with.  You can find this ID number by going to the Notifications>Directive Sets section and viewing the ID's in the first column.

PROFILE ID

Integer

The ID number of the target profile that will process the directives in the Directive Set.  The profile must be configured to have directives enabled, and the @prefix field processed enabled (if using the directive format in these examples).

Here is an example macro call with the relevant values

...

This field has an ID of 10200, so can be selected as follows:

Apply Unhappy

Apply OK

Apply Happy

Image ModifiedImage ModifiedImage Modified

After creating, they are listed:

...

Code Block
#generateDirectiveSetLink(LABEL,RUN AS USER,DIRECTIVESET ID,PROFILE ID)

Parameter Name

Description

LABEL

This parameter is the text that will show for the hyperlink in the notification.

RUN AS USER

This is the username of the Jira user that the Directives will be sent by.  This needs to be a user who is allowed to perform the issue actions that the directive is for. In later versions of JEMH this will need to be the user key instead of the username you can retrieve the user key by the velocity context for example using the userManager: $userManager.getUser('username').getKey() .

DIRECTIVE SET ID

This needs to be the ID number of the Directive Set that this link is to be associated with.  You can find this ID number by going to the Notifications>Directive Sets section and viewing the ID's in the first column.

PROFILE ID

This needs to be the ID number of the target profile that will process the directives in the Directive Set.  The profile must be configured to have directives enabled, and the @prefix field processed enabled (if using the directive format in these examples).

If your template is based off the built in JIRA style, you will most likely want to add the links within a "row wrapper" in order for them to not break the notification styling:

...