Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Documentation for variables (Slack official plugin)

Sean M
Contributor
July 31, 2019

This plugin creates the 'Notify Slack' post function that allows you to send a pre-formatted message at various steps in the workflow, which is fantastic!

The 'Message' field allows you to use variables such as $issue.status.name which will be substituted with the issue's status. If you click the 'Example' button, you can see that it's a Velocity template.

Where is the documentation for this? How sophisticated is this functionality? Can I use custom fields? I haven't been able to so far. I made some guesses and $issue.MyFieldName and $issue.customfield_12345 are just interpreted literally. I have even tried stuff like

#set ($customfield = $customFieldManager.getCustomFieldObject("customfield_12345"))
$issue.getCustomFieldValue($customfield)

but I get this in Slack

Error in Notify Slack configuration for project https://myjira.com/projects/MYPROJ Please contact your administrator to make sure that Notify Slack post-function comes after the issue creation.

(EDIT: I should note here that the post function does indeed come after issue creation, so the error message is not relevant)

Can anyone shed some light on this great new feature? Maybe my Velocity skills just aren't up to snuff? Or point me at wherever Atlassian has hidden the docs (the 'normal channels' take me here https://confluence.atlassian.com/slack/using-jira-applications-with-slack-966662163.html which is not helpful)

Much thanks,

1 answer

1 accepted

1 vote
Answer accepted
Luciano Fagundes
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 14, 2019

Hi Sean

The variables that we should be able to use in the "Notify Slack" post-function are the following ones:

context.put("user", event.getActor());
context.put("issue", event.getIssue());
context.put("project", event.getIssue().getProjectObject());
context.put("status", event.getIssue().getStatus());
context.put("priority", event.getIssue().getPriority());
context.put("issueType", event.getIssue().getIssueType());
context.put("creator", event.getIssue().getCreator());
context.put("assignee", event.getIssue().getAssignee());
context.put("reporter", event.getIssue().getReporter());
context.put("action", event.getActionName());
context.put("firstStep", event.getFirstStepName());
context.put("endStep", event.getEndStepName());

The integration does not grant access to internal Jira objects as that could be dangerous.

There is an improvement request opened to customize which fields could be displayed in the JIRA to Slack notification (refer API-95).

We hope the information above helps!

Cheers!

L.F

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events