Forums

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

Usage of "Send custom email" postfunction of scriptrunner in workflow

Mario
June 15, 2020

Hi there,

I'm quite new to Scriptrunner und just getting started. I want to use the "Send custom email" workflow postfunction of scriptrunner. Everything is almost fine but there remain two problems:

I'm using this body template:

<ul>
<li><b>Summary:</b> ${issue.summary} </li> <br>
<li><b>Issuekey:</b> ${issue.key}</li> <br>
<li><b>Priority:</b> ${issue.priority} </li> <br>
<li><b>Reporter:</b> ${issue.reporter} </li> <br>
<li><b>Created Date:</b> ${issue.created} </li> <br>
<li><b>Description:</b> ${issue.description} </li> <br>
<li><dl>
<dt><b>All Comments:</b></dt>
<br> XXX
</dl> </li> <br>
<li><b>Text123</b> <br> longer text sentence[...]
</li>
</ul>

1) The ouput of "priority" does not work. Neither in the preview nor in a real testmail. There always occurs:

Priority: IssueConstantImpl[[GenericEntity:Priority][sequence,4]statusColor,#EF612C[name,Very High][iconurl,/images/icons/priorities/major.svg][description,][id,10200]]

What am I doing wrong here? I just cannot figure out what is causing this?!

2) I need to include all comments of the issue (incl. a comment added during the transition of the triggering post function). Previously I've used the jmwe email issue postfunction, but it was limited as I need to change the real From-Sender-Address --> therefore I switched to the scriptrunner postfunction.

In the jmwe postfunction I used this code successfully (provided by the jmwe community leader) to catch all comments:

<%= issue.get("comment").collect{"<dd><li>"+it.bodyHtml+"</li></dd>"}.join('\n') %>

This does not work anymore in the template mentioned above.

How can I achieve in the scriptrunner postfunction to include all comments (at position XXX) of the affected issue in the template?

Thank you all very much for your help in advance.

Best regards
Mario

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
PD Sheehan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
November 9, 2021

I'm not familiar with the calendar gadget and ultimately, the issue could be with that gadget specifically.

But usually, when I've had issues finding a field in a gadget was because the "searcher" was not set correctly.

So go to custom fields, find your script field in the list. Select Edit from the Action cog and change the search template to "Date Time Range picker".

Depending on what the gadget is designed to filter on, this might work.

Priti Sonar
November 9, 2021

I already modified the Search Template based on gadget filter "Date Time Range Picker " I almost tried every searched filter , but of no use . I cannot see my scripted field in dashboard . Could you guide how scripted (date) field can be visible over any dashboard 

PD Sheehan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
November 9, 2021

This will depend on the design of the gadget.

I don't know which gadgets have the ability to select a custom date field. If you point me to a specific gadget and which add-on provides it, I can run some tests.

On a "Filter Results" gadget I have no problem selecting a scripted date field

Priti Sonar
November 9, 2021

Can you please test a scripted (date) field to be visible on a jira dashboard particularly jira issues calendar gadget ( field- date  drop down) and check whether the scripted (date) field is visible in that drop down 

PD Sheehan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
November 9, 2021

Ok, I found and installed the plugin with that gadget.

This gadget doesn't support scriptrunner scripted field.

It would appear that the gadget calls it's own internal API to get the list of valid date fields: <your jira base url>/rest/calendar-plugin/1.0/calendar/htmlcalendar/config/datefields

Which returned just fields of type date. It probably filters custom fields based on the custom field type rather than filtering on search template.

There is nothing you can do with your field as currently designed. The only recourse is to make a request to the maker of the plugin.

But if you really need this functionality, you would have to use a normal date picker field and have a script (perhaps listener) that populates and updates that field as necessary.

Priti Sonar
November 10, 2021

Thank you , for the quick response , will build a workaround 

Tenzing Doleck
Contributor
February 13, 2023

@Priti Sonar  may I ask what was the workaround?

TAGS
AUG Leaders

Atlassian Community Events