Automation to detect change clash
Asked by alasdairpa:

Hi all, fist time poster so please be gentle.

I've been asked to figure out an automation so that when a change is raised it will look for any other existing changes where the start/end times overlap and alert the creator, either by comment or email to say, 'clash detected with the following changes, please check', and then list them.

I've got the logic to find the clashes but the bit I'm struggling with is the comment or email. Because its in a branch anything I do happens on the found tickets not the trigger ticket.

Rule below:

![Screenshot 2024-09-15 105123.png](https://community.atlassian.com/t5/image/serverpage/image-id/347424i012AB13B1441B274/image-dimensions/456x592?v=v2 "Screenshot 2024-09-15 105123.png")

It is correctly finding the offending issues and logs them, but how can I get that info onto my trigger issue? or an email. If I use the email option it gives me a email per found issue, when I'd want 1 email with the issues listed, somehow.

![Screenshot 2024-09-15 105400.png](https://community.atlassian.com/t5/image/serverpage/image-id/347425iB24713D96F4FA643/image-size/large?v=v2&px=999 "Screenshot 2024-09-15 105400.png")

an yes, I've suggested they use the change calendar :)

Any suggestion most appreciated,

Al.


Answers:
author: Jack Brickey
body: Hi [@alasdairpa](/t5/user/viewprofilepage/user-id/5004453) , first of all welcome to the community.

What do you mean by "change Clash"? A change to what exactly?

With the above out-of-the-way, let me simply answer the one question you asked about ensuring that the action occurs on the trigger issue. First I am unsure why a branch would be needed here. I think the approach would be to use **Lookup Issues** instead. However, you can alway reference the trigger issue using the {{triggerissue}} smart value as well.

comments: author: alasdairpa
body: Hi Jack, thanks for you reply. When I say change I mean as in Change Enablement, but it could be for any type of ticket I guess so sorry if that's just confused things.

I'll take a step back as I'm probably going about this the wrong way.

As I mentioned the requirement is to alert when a new 'Change' issue is created, it should look for any existing issues where the start and end dates overlap, so they can check and move if necessary.

I had originally tried to do it with a look up issues as you say but could not make the JQL work, so I resorted to to what you see above.

I used info [here](https://stackoverflow.com/questions/325933/determine-whether-two-date-ranges-overlap) to get the logic for finding where date/times overlap, so the simplest way (assuming that Start is always before End) would be:

(StartA \<= EndB) and (EndA \>= StartB)

So I ended up with

project = "IT Service Management" and ({{triggerissue.Start Date/Time}} \<= {{issue.End Date/Time}}) AND ({{triggerissue.End Date/Time}} \>= {{issue.Start Date/Time}})

but it doesn't like where the time component is resolved as it has the '+':

![Screenshot 2024-09-16 090747.png](https://community.atlassian.com/t5/image/serverpage/image-id/347481i8E05C184D6911368/image-size/large?v=v2&px=999 "Screenshot 2024-09-16 090747.png")

So I've tried {{triggerissue.Start Date/Time.jqlDate.}} just to see if it will work, although I do need the time component, but can't get that working anyway.

using:

project = "IT Service Management" and ({{triggerissue.Start Date/Time.jqlDate}} \<= {{issue.End Date/Time.jqlDate}}) AND ({{triggerissue.End Date/Time.jqlDate}} \>= {{issue.Start Date/Time.jqlDate}})

gives:

![Screenshot 2024-09-16 091109.png](https://community.atlassian.com/t5/image/serverpage/image-id/347482i5CCFF102E52083F2/image-size/large?v=v2&px=999 "Screenshot 2024-09-16 091109.png")

So any suggestions on getting the lookup issues working or any other way of achieving this would be great, thanks again.

Al.


Tags: cloud

jira-service-management

jira-service-management-cloud