Versions Compared

Key

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

...

Once you have the transport created, you can set SMS Notification Mappings to send SMS notifications from Issue Created/Updated/Deleted events or SMS Post Functions to send SMS notifications from transition events.

Send

...

SMS notifications from issue events

Like Email or HipChat Notification MappingMappings, the SMS notification mapping is in charge of sending SMS messages from Issue events through the SMS Transport.

...

  1. Go to right corner Cog → JIRA Administration → Issue → Workflows. Edit the workflow of the project you want to add the Post Function
  2. Click on the transition you want to change and select the Post Functions tab. Click on Add post function
  3. Select Send SMS Notification by JEMHCloud and click Add
  4. Set the SMS Transport, to phone numbers (CSV) and Velocity script if necessary. Press Add/Update
  5. Move the Post Function to last position and publish the workflow draft.
  6. Remember to publish the workflow change draft! 
  7. To test the post function, go to an issue and perform the transition.
  8. Post function event should appear in JEMH Cloud → Notifications → Events.
  9. The event report:
  10. In Auditing → Outbound Messages, the table should show the SMS messages sent and the cog icon should show their contents.

...

Scripting

Both SMS notification mapping and SMS post function behavior behaviour can be changed at runtime with a user-defined Velocity Script. The script can use the event data or be time based to change how notifications are performed.

...

Code Block
titleChange to phone number when Critical
#if ($context.issue.fields.priority.name.textValue() != 'Critical') ## if issue priority is critical
  $smsNotificationUtils.resetToPhoneNumbers() ## Excluderemove the configuredexisting phone numbers infor the mapping or post function**current notification
  $smsNotificationUtils.addToPhoneNumber("+1234567") ## Sets the onlyadd phone number forto critical issues. **current notification
#end

Restrict notifications to specific time ranges

Code Block
titleNotify only after hours
#if (!$dateTimeUtils.betweenHours("18:00", "06:00")) ## during specific hours
   $smsNotificationUtils.inhibitNotification() ## SMSsprevent arecurrent not sent during business hours **SMS notification
#end

Restrict by priority

No Format
#if ($context.issue.fields.priority.name.textValue() != 'Blocker') ## if issue priority is not a blocker
   $smsNotificationUtils.inhibitNotification() ## prevent current SMS notification
#end


Warning

Velocity Script cannot be validated at configuration time (for example the dynamic phone numbers). You should test the script by re-executing events in Auditing → Events

Issue Updated SMS notifications

SMS messages are limited (in size and pricing) so JEMHC may not notify issue updates out of the box. Also you wouldn't want to spam your SMS users for every change in an issue. You can confirm that an issue updated event has been ignored (no SMS) if you see the line SMS message to phone numbers '+555123456' has not been sent as no useful information was displayed in the events report (Auditing → Events → Cog Icon → Report).

In order to send SMS messages from issue update, you would need to create a custom template containing the logic around which fields and in which conditions the SMS message must be sent. An example:

Send SMS notifications if the issue priority has been changed to Blocker.

In this example, the interested field is Priority and the condition is new value=Blocker. These are the steps to create and set an SMS Issue Updated template:

  1. Create a new Template by going to Notifications → Templates → Create 
  2. Set the name (Priority Update Template), select SMS theme, Issue Updated Template Type and copy from System Default Issue Updated Template
    Image Added
  3. In the edit screen enter the script you can find below
    screenshot-1.pngImage Added

  4. Code Block
    titlePriority Update SMS template
    #renderMessage()#if ($jemhUtils.isCreateOrInChangeLog($context, 'priority') 
    && $context.issue.fields.priority.name.textValue()=='Blocker'). New Priority: $context.issue.fields.priority.name.textValue() $jemhUtils.setFieldRendered() #end


  5. Go to Notifications → Notification Mappings → SMS → Edit → and change the Issue Updated template for the new template (Priority Update SMS template) and save. 
    Image Added
  6. If you change an issue priority of one of your issue to Blocker, the new template will print the priority in the message and notify JEMHC that the message has valid information (via the $jemhUtils.setFieldRendered() command).  JEMHC will now send the SMS to the handler's phone number. 
  7. You can confirm that the SMS has been sent by going to Auditing → Events→ Cog→ View Report
    Image Added

Info

You can add more fields and values by updating the template. For example the script:

Code Block
#renderMessage()#if ($jemhUtils.isCreateOrInChangeLog($context, 'priority') 
&& ($context.issue.fields.priority.name.textValue()=='Blocker' || $context.issue.fields.priority.name.textValue()=='Highest')). New Priority: $context.issue.fields.priority.name.textValue() $jemhUtils.setFieldRendered() #end #if ($jemhUtils.isCreateOrInChangeLog($context, 'status')). New Status: $context.issue.fields.status.name.textValue() $jemhUtils.setFieldRendered() #end

Will send an SMS if the issue priority has been changed to 'Blocker' or 'Highest' or if the issue status has also been changed.

Please note that the new lines are missing in the script so the SMS message doesn't have them.


Related articles

Filter by label (Content by label)
showLabelsfalse
max5
spacesJEMHC
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel in ( "events" , "notifications" ) and type = "page" and space = "JEMHC"
labelsnotifications events

...