Nedenstående antager, at der er en rolle på Projektet som hedder "ProjectNotificationList". Personer/gruppe i denne rolle vil få en mail.
Scripts ligger i /pack/jira-jelly
<JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.enterprise.JiraTagLib" xmlns:core="jelly:core" xmlns:log="jelly:log" xmlns:email="jelly:email" > <core:new className="java.util.Date" var="timestamp"/> <core:new className="java.text.SimpleDateFormat" var="format"> <core:arg type="java.lang.String" value="H"/> </core:new> <core:invoke on="${format}" var="hour" method="format"> <core:arg type="java.util.Date" value="${timestamp}"/> </core:invoke> <core:new className="java.text.SimpleDateFormat" var="format"> <core:arg type="java.lang.String" value="m"/> </core:new> <core:invoke on="${format}" var="minute" method="format"> <core:arg type="java.util.Date" value="${timestamp}"/> </core:invoke> <!-- Get handles --> <core:invokeStatic className="com.atlassian.jira.ComponentManager" method="getInstance" var="componentManager"/> <core:invoke on="${componentManager}" method="getProjectManager" var="projectManager"/> <core:invoke on="${projectManager}" method="getProjectObjects" var="projects"/> <core:choose> <core:when test="${not(hour == 0 and minute >= 0 and minute < 30)}"> <jira:Login username="automation" password="*****"> <core:invokeStatic className="com.atlassian.jira.component.ComponentAccessor" method="getUserUtil" var="userUtil"/> <log:info>Running CFW-2-Notification Jelly Script</log:info> <!-- Properties for the script --> <core:set var="comment">Sending out an automated notification for Filter Open - Major </core:set> <core:set var="workflowStep" value="Notify Project List Role" /> <core:set var="workflowUser" value="automation" /> <core:set var="CFWFilter2" value="10001" /> <core:set var="roleId" value="20201" /> <!-- Run the SearchRequestFilter --> <jira:RunSearchRequest filterid="${CFWFilter2}" var="issues" /> <core:forEach var="issue" items="${issues}"> <core:forEach var="project" items="${projects}"> <core:if test="${issue.project == project.id}" > <jira:GetProjectRoleActors projectkey="${project.key}" projectroleid="10201" var="roleactors" > <core:forEach var="actor" items="${roleactors.users}"> <!-- Get UserObject --> <core:invoke on="${userUtil}" method="getUser" var="user"> <core:arg type="java.lang.String" value="${actor.name}"/> </core:invoke> <log:warning>Emailing for Issue ${issue.key} to ${user.emailAddress}</log:warning> <!-- Send email to user --> <core:set var="emailMsg">Item ${issue.key}: "${issue.summary}" has been idle for an extended period of time. Please update and/or provide a comment. Thank you JIRA Administration </core:set> <email:email to="${user.emailAddress}" from="noreply@netic.dk" subject="Test fra NSPOP JIRA" server ="relay.netic.dk" message="${emailMsg}"/> </core:forEach> </jira:GetProjectRoleActors> </core:if> </core:forEach> </core:forEach> </jira:Login> </core:when> <core:otherwise> <log:warn>It's ${hour}:${minute} - not indexing as JIRA is probably optimizing.</log:warn> </core:otherwise> </core:choose> </JiraJelly> |