You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 14 Next »

Workflow Setup

Workflow

Notifikationer via mail

Nedenstående antager, at der er en rolle på Projektet som hedder "ProjectNotificationList". Personer/gruppe i denne rolle vil få en mail.

  • Notify "ProjectNotificationList" når en sag bliver oprettet uanset prioritet
  • Hvis tilstand er "Open"
    • Hvis prioritet er "Blocker" og sagen er urørt i 1 dag (CWF Filter 1 - Script CWF-1-Notification.xml)
    • issuetype in (Bug, "New Feature", Task) AND priority = Blocker AND status = Open

       

      • Hvis det er længere end 24 timer siden sidste notification, send notification.
    • Hvis prioritet er "Major" og sagen er urørt i 7 dage (CWF Filter 2 - Script CWF-2-Notification.xml)
    • issuetype in (Bug, "New Feature", Task) AND priority = Major AND status = Open AND updated < -7d

       

      • Hvis det er længere end 1 uge siden sidste notification, send notification.
  • Hvis tilstand er "Ordered"
    • Hvis prioritet er "Blocker" og sagen er urørt i 1 dag (CWF Filter 3 - Script CWF-3-Notification.xml)
    • issuetype in (Bug, "New Feature", Task) AND priority = Blocker AND status = Ordered

       

      • Hvis det er længere end 24 timer siden sidste notification, send notification.
    • Hvis prioritet er "Major" og sagen er urørt i 7 dage (CWF Filter 4 - Script CWF-4-Notification.xml)
    • issuetype in (Bug, "New Feature", Task) AND priority = Major AND status = Ordered AND updated < -7d

       

      • Hvis det er længere end 1 uge siden sidste notification, send notification.

JellyScripts

Scripts ligger i /pack/jira-jelly

CWF-2-Notification.xml

<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 &lt; 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">Issue ${issue.key}: "${issue.summary}" kræver aktion. Opdater eller fremsend venligst sagen..
             

Dette er en automatiseret mail der ikke kan besvares.
Kontakt Operatøren eller Driftsoperatører i forbindelse med spørgsmål.
            </core:set>
            <email:email to="${user.emailAddress}" from="noreply@netic.dk" subject="Issues på jra.nspop.dk der kræver aktion." 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>
  • No labels