Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Custom Scheduled Job -HTML Email Template not formatting as it should

Hi,

I created custom scheduled job with ScriptRunner that is checking all our projects and sending out emails to responsible for those projects. An email is basically a HTML table with relevant data for the responsible.

My problem here is that I can't seem to find the solution to format table the way I want. I can add borders, and change the background colors of the table rows and columns, but I cant make the table columns to have fixed width. It always has adjustable size (it takes the size of the text). 

Is there a workaround for this maybe? Am I doing something wrong here? Take a look at the "table" part of my code bellow.

 

if(mapResponsible.get(responsible2.toString()))
{
//style='border:1px solid black'
emailBody =

"<tr>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll'>" + issueTypeName + "</td>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll'>${overDue}</td>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll'>${overdueTime}</td>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll'>${mutablelink.key}</td>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll'>${projectNumber}</td>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll'>${msReviewType}</td>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll'>${reviewMs}</td>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll'>${commentFinding}</td>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll'>" + dueDateFormated + "</td>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll'>${severity}</td>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll'>${activity}</td>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll'>${desription}</td>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll'>" + url + "</td>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll; word-wrap:break-word;'>${referenceToDocuments}</td>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll'>${activityImplemented}</td>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll'>${responsible_2.displayName}</td>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll'>${qe_cs.displayName}</td>"+
"</tr>"


mapResponsible.put(responsible2.toString(), mapResponsible.get(responsible2.toString()) + emailBody);

} else // If responsible is not in the list: add responsible, add email body
{

emailBody =
"<table style='max-width: 8500px;'>"+ //style='width: 500px; table-layout:fixed; overflow: hidden;'
"<thead style='background-color: #dddddd'>"+


"<tr>"+
"<th style='width: 500px; overflow: scroll'> T </th>"+
"<th style='width: 500px; overflow: scroll'> OverDue </th>"+
"<th style='width: 500px; overflow: scroll'> Overdue Time </th>"+
"<th style='width: 500px; overflow: scroll'> Key </th>"+
"<th style='width: 500px; overflow: scroll'> Project Number </th>"+
"<th style='width: 500px; overflow: scroll'> MS Review Type </th>"+
"<th style='width: 500px; overflow: scroll'> MS Review </th>"+
"<th style='width: 500px; overflow: scroll'> Comment/Finding </th>"+
"<th style='width: 500px; overflow: scroll'> Due </th>"+
"<th style='width: 500px; overflow: scroll'> Severity of findings </th>"+
"<th style='width: 500px; overflow: scroll'> Activity </th>"+
"<th style='width: 500px; overflow: scroll'> Description of implemented activity </th>"+
"<th style='width: 500px; overflow: scroll'> Findings Link </th>"+
"<th style='width: 500px; overflow: scroll; word-wrap:break-word;'> Reference to Documents </th>"+
"<th style='width: 500px; overflow: scroll'> Activity implemented on Date </th>"+
"<th style='width: 500px; overflow: scroll'> Responsible for findings </th>"+
"<th style='width: 500px; overflow: scroll'> QE-CS </th>"+


"</tr>"+
"</div>"+
"</thead>"+

"<tr>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll'>" + issueTypeName + "</td>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll'>${overDue}</td>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll'>${overdueTime}</td>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll'>${mutablelink.key}</td>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll'>${projectNumber}</td>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll'>${msReviewType}</td>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll'>${reviewMs}</td>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll'>${commentFinding}</td>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll'>" + dueDateFormated + "</td>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll'>${severity}</td>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll'>${activity}</td>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll'>${desription}</td>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll'>" + url + "</td>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll; word-wrap:break-word;'>${referenceToDocuments}</td>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll'>${activityImplemented}</td>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll'>${responsible_2.displayName}</td>"+
"<td style='border-bottom: 2px solid #e8e3e3; border-right: 2px solid #e8e3e3; width: 500px; overflow: scroll'>${qe_cs.displayName}</td>"+
"</tr>"
mapResponsible.put(responsible2.toString(), emailBody);
if(mapCheck.get(responsible2.toString())){
mapCheck.put(responsible2.toString(), mapCheck.get(responsible2.toString()) + "f")
}else{
mapCheck.put(responsible2.toString(), "f")
}
log.debug(responsible2)

}

 

And it's also not working when I add width to for e.g. <tr> or anywhere.

Thanks in advance. 

1 answer

Hi kukabgd,

Can I please ask if you are using Jira Server or Jira Cloud as you have marked this answer as Jira Cloud and in Jira cloud, I can confirm that Atlassian does not provide any API's for sending custom emails and that they only provide the Send notification for Issue API which can send a notification when an issue is updated.

If you are using Jira Serv er then I would ask you to update the tags for this post to tag this as Jira Server so that users familiar with Jira Server can advise on this requirement.

Regards,

Kristian

Hi Kristian, 

thank you for the hint. You are right, we are using server.  I've updated tags. Hopefully now I can get some response to this question.

Regards,
Stefan

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you