Severe Acknowledgements

Peter Gomez November 30, 2016

I'm trying to figure out a way to convert a script we are using in our production environment that still utilizes the XML Jelly scripting in JIRA to the newer Java based Groovy scripts with the current version. Basically what it does is send out notifications to various IT personnel until the issue is acknowledged. I have been looking around ScriptRunner but can't find any way to accomplish this, anyone have any thoughts?

 

Here is a copy of the code:

<JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.enterprise.JiraTagLib" xmlns:core="jelly:core" xmlns:email="jelly:email" xmlns:log="jelly:log">
<core:invokeStatic className="com.atlassian.jira.ComponentManager" method="getInstance" var="componentManager"/>
<core:invoke on="${componentManager}" method="getProjectManager" var="projectManager"/>

 

<jira:Login username="scriptingaccount" password="**********">
<log:info>Running Close issues service</log:info>
<!-- Properties for the script -->

<core:set var="filter7Days" value="12748" />

<!-- Run the SearchRequestFilter -->
<jira:RunSearchRequest filterid="${filter7Days}" var="filterResults" />

<!-- Iterate over the issues -->

<core:forEach var="issue" items="${filterResults}">


<!--Calls User Manager to Get Username & Email address-->
<core:invokeStatic className="com.opensymphony.user.UserManager" method="getInstance" var="instance"></core:invokeStatic>

<core:invoke on="${instance}" method="getUser" var="user">
<core:arg type="java.lang.String" value="${issue.assignee}"/>
</core:invoke>


<!--Email content and logged message-->

<log:warn>Sending reminder email for ${issue.key}</log:warn>
<email:email to="first.last@example.com" from="supportgroup@example.com" subject="Critical Issue: ${issue.key} ${issue.summary} needs immediate attention"
server ="mail2">

Issue ${issue.summary} requires immediate attention.

Please acknowledge the error and between work.

Requester: ${issue.reporter}
URL: https://jira.ahsrcm.com/jira/browse/${issue.key}

</email:email>
</core:forEach>
</jira:Login>
</JiraJelly>

 

Thanks for the help.

 

-Peter

 

1 answer

0 votes
Jonny Carter
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 Leaders.
November 30, 2016

So, there are some built-in tools for ScriptRunner to send emails at various points.

There's a post-function and an event listener, which make it easy to fire an email when certain things happen.

It looks like your jelly script runs on a scheduled service. You could couple one of those options (an event listener or post function) with a service (perhaps the escalation service in particular) to send an email on a timed interval, rather than just waiting for a particular event or workflow to be executed.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events