Forums

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

ScriptRunner Custom Email PostFunction: Workflow buttons displaying incorrect transitions

Mike_Low April 7, 2020

PROBLEM:

After configuring a custom email via a postfunction rule (for CAB approvals) the workflow buttons configured in the email template preview are different to those displayed when the email is generated.

2020-04-15_15-52-35.png

GOAL: to have Approve Reject workflow buttons display in custom email as they do in the email template preview

 

STEPS

1. On the transition that leads to the CAB approval status create a post function rule > Script Post-Function (ScriptRunner) > Send a Custom Email

2. Capture all required fields but in the Email template field capture

The ${issue.issueType.name} <a href = "${baseUrl}/browse/${issue.getKey()}">${issue.getKey()}</a> with priority ${issue.priority?.name} is ready for Production.
<br><br>
Please approve for Production Deployment.
<br><br>
${getWorkflowButtons.call()}

3. Preview the email template and the workflow buttons that display will be "Approve for Deploy" and "Reject". This is correct and what I'm looking for

preview.png

4. Publish the workflow, move an issue into the CAB approval status (triggering the post function  rule) and view the email that is sent

RESULT

Workflow buttons in email show "Cancel" and "Close"

email buttons.png

EXPECTED RESULT

 Workflow buttons in email show "Approve for Deploy" and "Reject" as they do in the email template preview

OTHER CONSIDERATIONS

- The Approve for DEploy and Reject workflow buttons correctly display when viewing the Jira issue in Jira - see below

jira issue.png

- The Cancel and Close workflow buttons are the only 2 statuses configured to have all statuses be able to transition into them. The reason they don't display when viewing the jira issue itself is I have conditions setup on them not to display when the status was the CAB approval status. I did this as I didn't want the approval email being polluted with any other workflow buttons other than "Approve for Deploy" and "Reject".

Seems like somethings incorrect that fact that the preview and email are displaying differently?

1 answer

0 votes
Rubèn C_ September 29, 2021

This happens to us too.

Suggest an answer

Log in or Sign up to answer