Forums

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

Notification when the issue is not complete after x days

VENKATESHWARARAO
Contributor
May 12, 2020

Hi,

I have created a "Task" issue type while creating the issue i have one field "Target" in that i have two values x days and y days. I need to configure the email notifications to reporter, assignee .

1. if the issue is not closed or completed  within (x days or y days ) and notification email will be sent before 5 days and 3 days  and on x days. Is that possible.

2. I need to configure email notification If the issue is not updated on "In Progrees"  status more than 15 days.

Thank you in advance for your time and assistance.

3 answers

3 accepted

0 votes
Answer accepted
Alexey Matveev
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.
May 18, 2020

Hello @VENKATESHWARARAO !

As mentioned you can use many available apps for it (ScriptRunner, MyGroovy, Automation for Jira and many others).

I would like to add one more solution with the Power Scripts add-on.

1. You need to create a script like this (let's name this script test.sil):

/* select all issues which will be closed in 5 days */
string [] keys = selectIssues("key in silJQLExpression('startOfDay(currentDate()) - startOfDay(created) == millisToInterval(24*60*60*1000*#{Target}) - \"5d\"', 'issuetype = Task')");
for (string k in keys) {
sendEmail(reporter, assignee, "Issue" + k.key + "must be closed in 5 days");
}
/* select all issues which will be closed in 3 days */
keys = selectIssues("key in silJQLExpression('startOfDay(currentDate()) - startOfDay(created) == millisToInterval(24*60*60*1000*#{Target}) - \"3d\"', 'issuetype = Task')");
for (string k in keys) {
sendEmail(reporter, assignee, "Issue" + k.key + "must be closed in 3 days");
}
/* select issues In Progress and the status has not changed for more than 15 days" */
keys = selectIssues("status = \"In Progress\" and not status changed to \"In Progress\" after -15d");
for (string k in keys) {
sendEmail(reporter, assignee, "Issue" + k.key + "has not been moved from In Progress status for more than 15 days");
}

2. Add this script as a scheduled service:

Screenshot 2020-05-19 at 07.48.15.pngRun this schedule service under a user, who can select these issues. In my case admin:

Screenshot 2020-05-19 at 07.53.12.png

VENKATESHWARARAO
Contributor
May 18, 2020

Thank you Alexey,

In my JIRA we are using ScriptRunner addon could you please suggest how to do in ScriptRunner.

 

Thank you in advance.

Alexey Matveev
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.
May 19, 2020

I am sure it is possible with ScriptRunner. But I do not have a ready script for it. Hopefully, somebody else will provide a solution for it.

0 votes
Answer accepted
Jona Ittermann [Decadis AG]
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.
May 12, 2020

Hi @VENKATESHWARARAO

unfortunately, this is not possible with Jira default behavior and only possible by using 3rd party apps.

One possible app next to the orthers Jack already mentioned for this might be our app Jira Workflow Toolbox (https://marketplace.atlassian.com/apps/29496/jira-workflow-toolbox?hosting=server&tab=overview) which has a powerful automation engine integrated.

Of which type is your custom field and how are the values for x and y entered? Is it a custom text field with comma separated values, like "10,13" or how are they saved?

Just let me know. Then I can provide you a ready-to-use configuration so that you can set up and get started right away.

 

Cheers

Jona

 

Edit: Thank's Jack for your comment. It just slipped my mind. I clarified that JWT is our own product in the body of my post ;) 

Jack Brickey
Community Champion
May 12, 2020

Thanks for sharing Jona. In an effort to maintain transparency in the Community, please be sure to clearly identify this as your company's application when responding to Community posts. Atlassian-Community-online-guidelines-for-Marketplace-vendors 

BTW, JWT is a solid app to be sure!

VENKATESHWARARAO
Contributor
May 12, 2020

Thanks Jona. The Custom field "Target" is Drop down field. For example if i have configured drop down field as 30 days and 60 days. if i select first value i.e 30 days and if the issue is not closed with in 30 days then we need to send the notification email to reporter, assignee, project lead before 5 days, 2 days and 30th day . 

 

Thank you in advance.

Jona Ittermann [Decadis AG]
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.
May 13, 2020

Hi @VENKATESHWARARAO

thank's for clarification. I created a select list field with values "30 days" and "60 days". When we are then checking in the Automation rule on which day we are we only need the "30" without the "days" - that's why the boolean condition might be a bit confusing in first place but I tried to simply it by adding comments ;)

Grab the json snippet from below and import it to JWT (here we explain how you can do this https://apps.decadis.net/display/AUTOMATION/Import+and+export+rules). After this you might want to do the following things:

  • Adapt the specified time in the Scheduled trigger to your needs. Currently the rule (and therefor the emails will be sent) will run every day at 1am. But you can also set another time e.g. 9am or 2pm.
  • Select the correct project in the JQL selectors
  • Watch out for "%{issue.selector.cfnnnnn}" in the boolean condition (in line 5) and change it to the field code of your "Target" field (select it from the dropdown list underneath the text field). If the field code was "12345" you would enter %{issue.selector.cf12345}
  • Change the emails' content to whatever you want ;)

 

The rule would look like this:

automatic-email-notifications.png

 

{
"name" : "Automatic email notifications",
"description" : "",
"creator" : "admin",
"status" : false,
"triggerData" : "",
"triggerType" : "SCHEDULED",
"configuration" : {
"refs" : [ "issue", "system", "trigger.issue", "trigger.parent" ],
"runAs" : "admin",
"scheduledTriggerCron.dailyWeeklyMonthly" : "daily",
"scheduledTriggerCron.daysOfMonthOpt" : "dayOfMonth",
"scheduledTriggerCron.monthDay" : "1",
"scheduledTriggerCron.week" : "1",
"scheduledTriggerCron.day" : "1",
"scheduledTriggerCron.interval" : "0",
"scheduledTriggerCron.runOnceHours" : "1",
"scheduledTriggerCron.runOnceMins" : "0",
"scheduledTriggerCron.runOnceMeridian" : "am",
"scheduledTriggerCron.runFromHours" : "1",
"scheduledTriggerCron.runFromMeridian" : "am",
"scheduledTriggerCron.runToHours" : "1",
"scheduledTriggerCron.runToMeridian" : "am",
"triggerType" : ""
},
"children" : [ {
"sequence" : 0,
"type" : "JQL_SELECTOR",
"ruleEntityType" : "SELECTOR",
"configuration" : {
"refs" : [ "system" ],
"jql" : "project = DEMO",
"jqlParsingMode" : "jql",
"actingUser" : "field_00020"
},
"children" : [ {
"sequence" : 0,
"type" : "BOOLEAN_CONDITION",
"ruleEntityType" : "CONDITION",
"configuration" : {
"refs" : [ "issue", "issues", "selector.issue", "selector.parent", "system" ],
"expression" : "# Check that issue is not closed. Otherwise we won't proceed\r\n(%{issue.statusCategory} != \"Done\" or %{issue.resolution} = null) and (\r\n\r\n# Check if we breached the Target day (x). Note that in this case a new email will be sent every day after the breache if not other specified\r\naddDays({issue.created}, setNumber(\"x\",toNumber(first(findPattern(%{selector.issue.cf10600}, \"\\\\d+\")))), LOCAL) < {system.currentDateTime} \r\n\r\n# Check if we are on day x\r\nor datePart(addDays({issue.created}, getNumber(\"x\"), LOCAL), LOCAL) = datePart({system.currentDateTime}, LOCAL)\r\n\r\n# Check if we are 5 days before breache\r\nor datePart(addDays({issue.created}, (getNumber(\"x\") - 5), LOCAL), LOCAL) = datePart({system.currentDateTime}, LOCAL)\r\n\r\n# Check if we are 2 days before breache\r\nor datePart(addDays({issue.created}, (getNumber(\"x\") - 2), LOCAL), LOCAL) = datePart({system.currentDateTime}, LOCAL))",
"expressionParsingMode" : "logical",
"actingUser" : "field_00020"
},
"children" : [ {
"sequence" : 0,
"type" : "SEND_MAIL",
"ruleEntityType" : "ACTION",
"configuration" : {
"refs" : [ "issue", "issues", "selector.issue", "selector.parent", "system" ],
"fromOption" : "default",
"toUsersInField" : [ "00003", "00052", "00006" ],
"subject" : "Action needed - %{selector.issue.key}",
"subjectParsingMode" : "textBasic",
"contentType" : "text/html",
"mailPriority" : "3",
"sendingMode" : "common",
"body" : "<p>Hi there! <br></p>\r\n\r\n<p>\r\nYou may want to take a look at this issue since the specified target date will be breached shortly or has already been breached.\r\n<br>\r\n</p>\r\n<p>Cheers!</p>",
"bodyParsingMode" : "textBasic"
},
"children" : null,
"hasChildren" : false
} ],
"hasChildren" : true
} ],
"hasChildren" : true
}, {
"sequence" : 1,
"type" : "JQL_SELECTOR",
"ruleEntityType" : "SELECTOR",
"configuration" : {
"refs" : [ "system" ],
"jql" : "project = DEMO and status = \"In Progress\" and updated <= startOfDay(-15d)",
"jqlParsingMode" : "jql",
"actingUser" : "field_00020"
},
"children" : [ {
"sequence" : 0,
"type" : "SEND_MAIL",
"ruleEntityType" : "ACTION",
"configuration" : {
"refs" : [ "issue", "issues", "selector.issue", "selector.parent", "system" ],
"fromOption" : "default",
"toUsersInField" : [ "00003", "00052", "00006" ],
"subject" : "Action needed - %{selector.issue.key}",
"subjectParsingMode" : "textBasic",
"contentType" : "text/html",
"mailPriority" : "3",
"sendingMode" : "common",
"body" : "<p>Hi there! <br></p>\r\n\r\n<p>\r\nIt seems as if the issue has not been updated for 15 days in a row. Maybe you want to give it another try.\r\n<br>\r\n</p>\r\n\r\n<p>Cheers!</p>",
"bodyParsingMode" : "textBasic"
},
"children" : null,
"hasChildren" : false
} ],
"hasChildren" : true
} ],
"hasChildren" : true
}

 

Let me know, if this works!

Cheers

Jona

Like Max Foerster - K15t likes this
0 votes
Answer accepted
Jack Brickey
Community Champion
May 12, 2020

You would need a scripting or automation addon for this, e.g. Scriptrunner, Power Scripts, Automation for Jira. I use the later in Cloud.

Suggest an answer

Log in or Sign up to answer