Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,467,291
Community Members
 
Community Events
177
Community Groups

How can I detect the Conflict existing ticket in the issuetype having same start date and time

I want to detect the conflict of the existing tickets having Same date and time ie; (date and time field) while creating a new ticket that can able thrown an error when same date and time is selected.

This enhancement project will be to determine the best method for using some scheduling conflict detection logic in the project.
Problem: Today, when users create a new ticket in the issuetype of project, there is nothing that will determine whether or not the new tickets will conflict with an existing tickets that may have already been scheduled status.

Conflict Detection Logic:
POD (Multiple Select) ------> Custom field
POD Conflict Detection: If the ticket being created has the same POD# as a change already on the calendar the user should get a Yellow Pop-UP that states, “A change on this POD already exists on the calendar for this date & time. Please ensure your change does not conflict with existing change before submitting your ticket.”

DataCenter(Multiple Select) -------> Custom Field
DataCenter Conflict Detection: If the ticket being created has the same DataCenter(s) as a change already on the calendar the user should get a Yellow Pop-UP that states, “A change on this Datacenter(s) already exists on the calendar for this date & time. Please ensure your change does not conflict with existing change before submitting your ticket.”

Service Provider-----> Custom field
Service Provider Conflict Detection: If the ticket being created has the same Service Provider(s) as a change already on the calendar the user should get a Yellow Pop-UP that states, “A change for this Service Provider(s) already exists on the calendar for this date & time. Please ensure your change does not conflict with existing change before submitting your ticket.”

Multiple Conflict Detection: If two or more of these conditions are met the user should get a Red Pop-Up Warning that states, “Two or more conflicts detected (POD, DC, Service Provider) with an existing change. Please ensure your change does not conflict with existing change before submitting your ICC ticket.”

A user should not be denied the ability to create a change based on this logic, but simply receive a warning that their change may be in conflict with a previously scheduled change.

1 answer

0 votes

Hi @Imran Khan 

This can be achieved by using ScriptRunner for Jira. On server you can use the Behaviours that will and can show messages on the create issue screen but a Workflow validator can also be used to have a bit more proper restriction. Since you want use to be able to create the issues then using behaviour can be used to display some message to the user.

I hope it helps.

Ravi

Hi Ravi Sagar,

Thanks for your quick response, I'm using below script which throws the error but the problem is when date and time it is not considering particular time frame, it is considering the whole day for example if a ticket is created with 16 March with time 5:30pm, and when i start to create a new ticket with that date 16March it is throwing error, i need to want to through error when the same date and time is selected, Is that can be achived?

import com.atlassian.jira.bc.issue.search.SearchService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.search.SearchResults
import com.atlassian.jira.jql.parser.JqlQueryParser
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.web.bean.PagerFilter
import com.atlassian.query.Query

def artefactId = getFieldByName("POD (Multiple Select)")
def artefactIdValue = artefactId.getValue() as String
artefactIdValue = artefactIdValue.replaceAll("[\\[\\]]","\"")
artefactIdValue = artefactIdValue.replaceAll(", ","\", \"")
def artefactId1 = getFieldByName("Start Date & Time")
def artefactIdValue1 = artefactId.getValue() as String
artefactIdValue = artefactIdValue.replaceAll("[\\[\\]]","\"")
artefactIdValue = artefactIdValue.replaceAll(", ","\", \"")
String projectKey = null
def projectObj = underlyingIssue?.getProjectObject()

if (projectObj) {
projectKey = projectObj.key
} else {
projectObj = getIssueContext().getProjectObject()
projectKey = projectObj?.getKey()
}
def jql = "project = \"${projectKey}\" AND \"POD (Multiple Select)\" in (${artefactIdValue}) AND \"Start Date & Time\" >= 1d AND status in (Scheduled) AND status not in (Closed)"
int jqlIssues = getIssuesFromJQL(jql)
//artefactId.setHelpText(jql)
if(jqlIssues > 0){
artefactId.setHelpText("<a style=\"color:gold;\">POD has a Confliction</a> ${jqlIssues}")
}
else{
artefactId.setHelpText("")
}

int getIssuesFromJQL(String jqlQuery) {
ApplicationUser user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
IssueManager issueManager = ComponentAccessor.getIssueManager()
JqlQueryParser jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser.class)
SearchService searchService = ComponentAccessor.getComponent(SearchService.class)
Query query = jqlQueryParser.parseQuery(jqlQuery)
def count = searchService.searchCountOverrideSecurity(user, query)
//SearchResults searchResults = searchService.search(user, query, PagerFilter.getUnlimitedFilter())
//List<MutableIssue> mutableIssueList = searchResults.getIssues().collect { issue -> issueManager.getIssueObject(issue.getId()) }
return count
}

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events