Forums

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

Scriptrunner send an email function, workflow button click always fails

Stephen Letch
Contributor
January 11, 2019

Hi

I'm trying to get round the limitations of Jira Service Desk automation by using Scriptrunner for the approval functionality, The main reason for this is we want to include custom fields in the emails that go to approvers so they can get all the change ticket info in the email then click approve/decline from there.

Email code:

Dear <% out << issue.assignee?.displayName %>,
<br>
The $issue.issueType.name $issue.key with priority <% out << issue.priority?.name %> has been assigned to you.
<br>
Description: ${issue.description}
<br>
Implementation Details: <% out << issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Implementation Details")) %>
<br>
Regards,
<% out << issue.reporter?.displayName %>
${getWorkflowButtons.call()}

send email.png

I've gotten as far as adding the example on the scriptrunner quick reference and modifying it a bit, it's even including the workflow buttons


email.png

Unfortunately every time I try and click the workflow button I get errors.

result.png

I've even tried removing the approval function from the statuses to see if that was the issue but nope, same issue, thought it might have been the post function being to high in the post functions order but nope, made it the last thing in the list and still the same result.

 

I'm not much of a coder at all, have to go scraping for examples whenever I want to do something like this, so, is there a way I can get this working?

 

Only other option is to try and copy the contents of 5 custom text fields to the bottom of the description and let the JSD approval emails do it, only problem is I cant find a script for that either XD

 

Any help would be appreciated

6 answers

1 accepted

1 vote
Answer accepted
Brittany Wispell
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 7, 2019

This was a confirmed bug and was resolved on versions 5.5.0 & 5.5.2 of ScriptRunner for Jira Server/Datacenter. 

1 vote
jane chen
Contributor
March 8, 2020

I also use this code to show transition buttons in email

${getWorkflowButtons.call()}

but when reviewer clicks the button in email, he/she always encounters the problem of "XSRF security token missing"? how can I resolve this problem?

desarrollo September 18, 2020

Hello @jane chen

I have the same problem, did you get a solution for this issue?

 

Regards,

0 votes
amit anand May 15, 2020

Above is working fine for me.

Just a query

How to add hyperlink to SUP-369 ?

In addition to this i need to have epic name also to be displayed,what change we have to do?

 

Thanks

Amit Anand

Brittany Wispell
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 22, 2020
0 votes
Tomasz Bryła
Contributor
November 9, 2019

Hi @Brittany Wispell 

I have Done button (which is global transition ) in workflow. When I use a getWorkflowButtons.call(), jira send to approver Accept, Reject and global Done buttons. Is any way to send message without Done buton? I add condition to Done transition issue.status.name != 'In review' but this doesn't help.obraz.png

jane chen
Contributor
February 13, 2020

if don't want transition from In review to Done, why not just modify your workflow to remove that transition? buttons should changes accordingly. the buttons get from getWorkflowButtons.call() is just the same as what buttons you can see from jira issue view.

0 votes
Sid May 2, 2019

@Stephen Letch  did you get a solution for this issue. I am having the exact same issue you are having.

Thanks

Brittany Wispell
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 6, 2019

I will get with our ScriptRunner team to see if this has been updated yet. 

Like Binaya Kc likes this
Binaya Kc
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 7, 2019

Any update on this @Brittany Wispell ?

Brittany Wispell
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 7, 2019

@Sid  & @Binaya Kc 

It was confirmed a bug and was resolved on versions 5.5.2 of ScriptRunner for Jira Server/Datacenter. 

If you have any other questions please let me know. 

Like Binaya Kc likes this
0 votes
Brittany Wispell
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 11, 2019

@Stephen Letch

This to me looks like a ScriptRunner bug. I'd suggest raising a ticket with them see link below. 

ScriptRunner Product Support

Let me know if you have any other questions. Well done on scrapping this together! It looks good. :)

Stephen Letch
Contributor
January 11, 2019

Have done, thanks

Like Brittany Wispell likes this

Suggest an answer

Log in or Sign up to answer