Forums

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

View a text filed as a table within a custom email

Iryna Pazharytskaya March 8, 2022

Dear all,

 

I have a question on the custom email sent from Listeners in Jira.

We have X field of the multiline text type and it's default vale is set through the Behaviour that cretaes a template that contains table. You can check its visual representation (the way it shows on the view screen) in the TableVisual and its row version (how its default value is set) in the TableRaw screens attached. tableRaw.PNGTableVisual.PNG

Then any time the tabel is updated the idea is to send a custom email using Listener Send custom email when Issue is updated based on the following condition:

 

def change = changeItems.find {it.field == "X field"}
if (change) {
def oldValue = change.oldstring
def newValue = change.newstring

Emailtemplate is as follows:

 

Dear all,

The table has been updated.
<%
def change = event?.getChangeLog()?.getRelated("ChildChangeItem").find {it.field == "Additional Information"}
if (change) {
out << 'Old: ' + "\n\n" + change.oldstring + "\n\n"
out << 'New: ' + "\n\n" + change.newstring
}
%>
Thank you!

As you can see I want to send the X field (table) the way it looked before and after the update.

The problem is that in the email the table looks as its row version. See the screen shot below:

Email.PNG

Is there any way to make it look as the table from the visual screen within the email?

 

Thank you,

 

Iryna

1 answer

1 vote
Mark Segall
Community Champion
March 8, 2022

Hi @Iryna Pazharytskaya 

I'm not familiar with how to do this in script runner, but this is fairly simple with Jira Automation:

  • TRIGGER: Field Value Changed
  • ACTION: Send Email

In your send email action you would add this to the body

{{issue.customfield_xxxxx.html}}
Iryna Pazharytskaya March 9, 2022

hi @Mark Segall

Thank you for the reply. We dont use triggers, and also field will be updated and therefore the email will be sent regardless of the status.

 

Best,

 

Iryna

Mark Segall
Community Champion
March 9, 2022

Hi @Iryna Pazharytskaya - I was speaking to using Jira Automation instead of script runner.  You can add a condition for status. This type of rule can be set up in just a couple minutes.

Iryna Pazharytskaya April 12, 2022

Hi @Mark Segall ,

 

Do you mean Listener? Also as I have been investigating further on my issue, what actually have is a Wiki renderer field that contains a table (using ||||). It looks nice and all, but I am still struggling to implement it in the email, it looks like a raw html version even if I use 

{{issue.customfield_xxxxx.html}}

format.  I also tried using it within Listener and it doesn't work.

 

Iryna

Mark Segall
Community Champion
April 12, 2022

Hi @Iryna Pazharytskaya - I was referring to automation for Jira which is a built-in functionality of Jira, independent of script runner.  If you prefer to handle this in script runner, I'll need to defer to someone else in the community to assist on this.

Iryna Pazharytskaya April 12, 2022

Hi @Mark Segall

I figured out how to use it in the srcipt runner Listener. But I still need to be able to use it within the Send email post function. So if you have some tips I would appreciate it.

Thank you,

 

Iryna

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events