Automation rule for job created by email...

Mark Baker October 2, 2020

HI there, 

I am trying to build an automation on a job coming in via email...

I want the automation routeen to look at the domain name of the email and if it matches my rule it updates a custom field.

 

i.e. mark@hollington.com   changes a custom field to a pre-defined value of Hollington

 

I can't get my head around how to do this?

4 answers

1 accepted

1 vote
Answer accepted
Diskonekted October 11, 2020

Hi Mark,

So to confirm, does a ticket already exist within Jira or do you want to create one based off the email domain?

If the latter, you can do this via the following:

Settings > System > Mail > Incoming Mail > Add Incoming Mail Handler

On the second screen, there is a field 'Catch Email Address' this will trigger the action (E.g. create new ticket, update existing ticket, etc.) for anything that hits that address - like the one you reference above.

If it's the former, and you're already creating issues based off incoming mail and just want to update them then you'd look towards the automation rules (Note that the default action for a mail handler is to create a ticket or update an existing one' - so this may already do what you're after).

Settings > System > Automation > Automation Rules > Create Rule

Then choose the Trigger of 'Issue Created', add a new condition of 'Advanced Compare Condition' with the following parameters:

First value: {{reporter.emailAddress}}

Condition: Contains

Second Value: mark@hollington.com

Lastly, add a new action of 'Edit Issue' being sure to choose the field you wish to edit (Requires that you've created the custom field already).

 

Final note: Be sure to set the mail handler and the automation rule to the same project; a mail handler can only be associated to a project - whereas a rule can be global and trigger based off the broad conditions. Depending on how you're setting the automation rules, the conditions may be too constrained (I.e. looking for issues created in 'ProjectB', but the mail handler is creating them in 'ProjectA').

Worked perfectly. Thank you Diskonekted

Mark Baker October 21, 2020

This is great, thank you Diskonekted 

1 vote
Diskonekted October 11, 2020

Right, so assuming you've already got an Incoming Mail Handler (part 1) you can move to part 2.

1. Incoming Mail Handlers

Project Settings > Mail > Incoming Mail > Add Incoming Mail Handler

Make sure you set the mail handler for the correct project and using the 'Catch Email Address' for "mark@hollington.com".

Assuming you went with the default action (E.g. Create or update a ticket) this will create a ticket everytime someone emails that address.

2. Setting the automated activity

Project Settings > Automation > Automation Rules > Create Rule

Set the following:

Trigger: When Issue Created

Condition: If Advanced Compare condition

  First value: {{reporter.emailAddress}}

  Condition: Contains

  Second Value: @hollington.com

Then: Edit Issue Fields

  Field: Custom Field

  Value: Foo 

Benjamin Peikes June 28, 2023

A couple things to watch out for.

1) If the Default Reporter for the mail handler becomes disabled, ie they leave the org, The handler will silently fail.

2) If you then set the Default Reporter to “Automation for Jira”, issues will be created, but the “Create Issue” event does not get raised for any additional automation rules. This also occurs silently. Your automation rule wont show anything in its log.

0 votes
Diskonekted October 11, 2020

For note, you'll need to adjust the above to suit your conditions - my testing was to simply add a label to some tickets, but you'll know what fields you want to adjust and with what values.

Hope that helps.

0 votes
Diskonekted October 11, 2020

Hi Mark,

I posted a lengthy response to this detailing how it can be done, but seems that my post was lost. Will try to re-port once I've put the steps back together again.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events