The HR project

Users will often want to get progress updates on their issues after they have logged them. So, instead of business users having to ask for updates, we will proactively update them through our newly acquired knowledge, that is, JIRA notifications.

In Chapter 5Field Management, we added a custom field called Direct Manager, which allows users to add the manager of the new employee or leaving employee, so she can be kept in the loop.

The other customization we made in Chapter 7Workflow and Business Process, is the addition of new transitions in the workflow. We need to make sure that those transitions fire appropriate events and also send out notifications. In summary, we need to do the following:

  • Send out notifications for the events fired by our custom workflow transitions
  • Send out notifications to users specified in our Direct Manager custom field

While you can achieve both using other JIRA features, such as adding users as watchers to the issue and reusing existing JIRA system events, this exercise will explore the options available to you. In later chapters, you will see there are other criteria to consider while deciding on the best approach.

Setting up mail servers

The first step to enable e-mail communication, as you will have guessed, is to register mail servers in JIRA. If you are using the standalone distribution of JIRA, it is recommended that you add your mail server by entering the host information:

  1. Log in to JIRA as a JIRA administrator.
  2. Browse to the JIRA administration console.
  3. Select the System tab and then the Outgoing Mail option.
  4. Click on the Configure new SMTP mail server button.
  5. Enter your mail server information. If you do not have a mail server handy, you can sign up for a free Gmail account and use that for testing purposes.

After adding your mail server, you can try sending yourself a quick test e-mail to check whether JIRA is able to access your server successfully.

Updating workflow post functions

In Chapter 7Workflow and Business Process, we created a few new workflow transitions. We now need to update these new transitions to make sure they fire appropriate events.

  1. Browse to the View Workflows page.
  2. Click on the Edit link for HR: Termination Workflow.
  3. Click on any transitions other than Done.
  4. Update the post function to fire the Issue Updated event rather than the Generic Event.
  5. Repeat this for all other transitions except the Done transition.
  6. Publish the draft workflow. You can save a backup copy in case you want to revert.

We are using the Issue Updated event because it reflects the fact that the issue is being updated; also, the event is tied to more appropriate e-mail templates. We can of course, also create new custom event and e-mail templates and make the post function to fire the custom event instead.

Setting up a notification scheme

Now, you need to have your own notification scheme, so you can start adding notifications to your events. We will base our notification scheme on the default scheme to help us get things set up quickly:

  1. Select the Issues tab and then the Notification schemes option.
  2. Click on the Copy link for Default Notification Scheme.
  3. Click on the Edit link of the copied notification scheme.
  4. Rename it HR Notification Scheme and click on Update.

This will create a new notification scheme with the basic notifications prepopulated. All you need to do now is modify the events and add your own notification needs.

Setting up notifications

There are two rules you need to follow to add notifications. First, you need to add notifications for your custom events so that e-mails will be sent out when they are fired. Second, you will want users specified in the CC list custom field to also receive e-mails along with the assignee and reporter of the issue:

  1. Click on the Notifications link for HR Notification Scheme.
  2. Click on the Add notification link.
  3. Select the Issue Updated event type.
  4. Select User Custom Field Value for the notification type and select Direct Manager from the drop-down list.
  5. Click on the Add button.

Nice and easy. With just a few clicks, you have added the Direct Manager custom field to the notification scheme. So now, regardless who is put into the field, the user will receive notifications for issue updates.

Putting it together

The last step, as always, is to associate your scheme with projects for activation:

  1. Browse to the HR project's administration page.
  2. Select the Notifications option from the left panel.
  3. Select Use a different scheme in the Actions menu.
  4. Select the new HR Notification Scheme we just created.
  5. Click on the Associate button.

With just a few clicks, you enable JIRA to automatically send out e-mails to update users with their issue's progress. Not only this, but you have tied in the custom fields you created from earlier chapters to manage who, along with the issue assignee and reporter, will also get these notifications. So let's put this to the test!

  1. Create a new Termination issue in the HR project.
  2. Select a user for the Direct Manager custom field. It is a good idea not to select yourself since the reporter will get notifications by default. Also, make sure that the user selected has a valid e-mail address.
  3. Transition the issue to move along the workflow.
  4. You will receive e-mails from JIRA within minutes.

If you do not receive e-mails from JIRA, check your mail queue and check whether the mail is being generated and follow the steps from the Troubleshooting notifications section in this chapter.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset