Hi,
I'm using Automation Lite for JIRA and JIRA Service Desk Server. I was wondering if there was a way to set up a due date for a ticket based on priority set.
For example,
Thank you!
Hey Samantha,
Using Automation for Jira it is dead simple and should take less than a minute or so to set up.
Create a rule with the following:
You rule will look something like this:
The magic here is taking the date/time that the rule is run and adding 4 days to it. You can also use business days by using: "{{#now}}func=plusBusinessDays(4){{/}}"
Hope that is what you were after.
Cheers,
Nick
Hi Nick,
This is exactly what I was after! Is there a way to have multiple IF, ELSE statements. For example, IF P1 then X due date. IF P2 then Y due date within one automation rule? Or do they all need to be seperated?
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Samantha,
You can either do it as seperate rules or you can do it in the same rule by "branching" on the current issue like this:
We should be implementing if/else soon which will make it even simpler.
Cheers,
Nick
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Nice work Nick - how far off is the if/else branching? Just evaluating the Automation AddOn for this exact use-case, but with priority defined within a custom field, where we're using the Compare2Values condition.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Brian,
We released if/else earlier in May.
You can read this at - https://blog.codebarrel.io/the-votes-have-been-counted-else-if-has-shipped-a8b1d3eb28cf
Reach out if you need me to help you through it.
Cheers,
NIck
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
A shame we don't have the Pro version :( So we cannot use the branching feature.
I'll have to stick to creating separate rules for that :/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
I tried this solution and in the Audit Log it's showing status as "Success" but my "Due Date" field is still blank on the newly created tickets. Can anyone give me any advice as to why this is happening?
Thanks!
Olivia
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Olivia,
Would you please share your solution?
I am having the same issue.
Thanks,
Miroslav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Miroslav,
Here is the code I used in the "Edit issue fields" portion:
{{#now}}func=plusBusinessDays(5){{/}}
When I originally input the code, I had quotation marks around it, which is why mine was not working.
Hope this helps!
Thanks,
Olivia
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Olivia!
I ended up using {{issue.created.plusBusinessDays(1)}} and it worked.
Unfortunately, I cannot get it to work with hours instead of days. For example, if an incident gets created at 11:00 AM on a Wednesday and my SLA is 8 hours, but my calendar counts only 8:30 to 17:00, I cannot get the due date set to tomorrow if I use {{issue.created.plusHours(8)}}. I don't think Automation for Jira takes into account my calendar. It just sets the due date for the same day.
It would be nice to have a bit more control over it, but I'll live :)
Cheers,
Miroslav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Samantha
That's definitely doable if you have scriptrunner plugin installed on your jira instance.
here are the steps
1. remove due date field from the create screen/ customer portal(service desk) so that it should not be accidentally modified
2. configure scripted post function on the create transition and use below script
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import com.opensymphony.workflow.InvalidInputException
import java.sql.Timestamp;
import com.atlassian.jira.issue.customfields.manager.OptionsManager
import com.atlassian.jira.issue.customfields.option.Option
import groovy.time.*
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.crowd.embedded.api.User
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def issueManager = ComponentAccessor.getIssueManager()
MutableIssue mIssue = issue
def priority = customFieldManager.getPriority().getName()
Calendar cal = Calendar.getInstance();
def temp = cal.getTimeInMillis();
def add = 0;
def x = 1000*24*60*60L
def mydueDate = new Timestamp(cal.getTimeInMillis());
if (priority == "P0")
{
add = 2*x // number denotes days
temp = temp+add
mydueDate.setTime(temp)
mIssue.setDueDat(mydueDate)
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
issueManager.updateIssue(currentUser, issue, EventDispatchOption.DO_NOT_DISPATCH, false)
}
else if (priority == "p1")
{
add = 4*x // number denotes days
temp = temp+add
mydueDate.setTime(temp)
mIssue.setDueDat(mydueDate)
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
issueManager.updateIssue(currentUser, issue, EventDispatchOption.DO_NOT_DISPATCH, false)
}else{
add = 30*x // number denotes days
temp = temp+add
mydueDate.setTime(temp)
mIssue.setDueDat(mydueDate)
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
issueManager.updateIssue(currentUser, issue, EventDispatchOption.DO_NOT_DISPATCH, false)
}
Let me know if you face any issues.
BR
Rahul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.