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,362,086
Community Members
 
Community Events
168
Community Groups

E-mail when date of an attribute is near

Hey @AlL

I want Jira to send me an e-mail when a date in an insight objekt is reached,... well, some days befor it'S reached.

Reason:
I insert every laptop of our company in insight, and attached an attribute named "support end date" wich is as date formated, and i want to be informed when the support is going to end.

Automation:
I like Jira to check everyday if todays date is the "support end date" date (minus one week) and if so, to send me an e-mail with the objekt name and some text.


Is this possible?
If yes, then how,... i didn't see anything in the automation section of "Jira Service Management" to help my case...

Thanks in advance!

BR
Andy

1 answer

1 accepted

0 votes
Answer accepted
Alex Koxaras Community Leader Aug 18, 2022

Hi @Andreas Dellmour 

There is a way to acquire the date of the specific insight object, but you can't really use it, since it's not aligned with the "jira date" and you can't really change it using smart values. Due to the face that I find your question a really good exercise, I'll continue my tests to find an answer, but I think that the margin is rather slim -> https://jira.atlassian.com/browse/JSDCLOUD-9873

That would be great, thank you! :)
Could you send me an example on how to acquire the date/attribute information of an specific insight object?

Dude!

Got it! :)

Sorry for the late reply but I reaaally wanted to do it! As I told you is a good exercise! Without getting into details of how and why, here is the solution:

 

  1. First, create a custom Insight object field. In my case I named it CDI.
  2. Place the above field on the appropriate screens of your project
  3. Setup CDI field but its all up to how you have set up your objects really (in my case Computers was an object one level below Hardware object):
    setupInsightField.png
  4. In the above settings change the "Date" attribute to yours, as well as both IQLs
  5. Create the following rule
  6. Adjust the rule to your likings

 

 

Rule

Overview of the rule. Keep in mind that you have to change the TRIGGER, most like to a scheduled one, to check once per day.

myRule001.png

Create a Variable

Inside this variable we will store the insight object's value

myRule002.png

Compare Dates

First value:

{{jiraDate.match("((\d{2})\/(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\/(\d{2}))$").toDate.plusDays(7)}} 

myRule003.png

Send email

Of course you can change the following to your likings!

myRule004.png

 

Results

results0001.png

 

I needed a few hours to get this working due to the fact that Insight Date Attribute was not in fact a date.

Hope that this was what you were looking for! Let me know if that worked out for you.

Alex

Like # people like this

How and where do I setup such object like your CDI?
I use Jira since 4 weeks, and most of the time I just update the insight database...

Do I need to create a project for it to work?
I hoped I could just run it paralell,...

like, check everyday if any object with this attribute is near todays date....

  • Go to cog (upper right on your jira screen) and click it
  • Click on "Issues"cog1.png
  • Find on your left the selection "Custom Fields" and click it
  • Click Create Custom Field
    cf create cf.png
  • Click "Advance" and find the Insight Object custom field. Click it and select ok
  • Give your field a name
  • On the next screen place your field in the appropriate screens of your project
  • Click "Update"
  • Search for your field again and from the three dots on the right of your field click on the selection "Context and default value"
    context default values.png
  • Edit Object
    Edit insight object.png
  • Insert appropriate values

field scooe.png

  • Click Save

 

All the above is kind of standard procedure for creating a Custom Field. And this custom field has to be populated.. :/

Like Stefan Salzl likes this
Alex Koxaras Community Leader Aug 18, 2022

Now.. concerning the project: Automation rules live within project. Can't say that I have ever used a rule without a project. From what I know, yes you will need a project to do that. And to be honest I thought you had already a project with all assets associated to issues.

I'm not sure that Insight has a built in system for checking values. You can read more about it here: https://support.atlassian.com/jira-service-management-cloud/docs/what-is-insight-in-jira-service-management-cloud/

Like Andreas Dellmour likes this

I think I did something wrong,...

FYI:

Thats where the attribute is, in insight:

Insight_attribute.jpg

 

Thats how i created the insight object. The Automation Rule is in ITSM - Controlling & IT

Insight_Object.jpg

 

that's what i entered in the create variable step.

create_variable.jpg

 

The variable dosn't get filled, it stays emtpy so it cant get the object to campare and wont send any email,...

Do you see any error I made?

 

BR Andy

Alex Koxaras Community Leader Aug 19, 2022

@Andreas Dellmour 

Two things to correct:

edit.png

 

And on the rule, while comparing variable, the second field must be populated with {{wartungsende.wartungsvertag bis}}

Like Andreas Dellmour likes this

 

My Insight-Object looks now like this:

Insight_Object.jpg

I changed the variable to this:

create_variable.jpg

 

 

the coparisson looks like this, nothing changedRule_Comparisson.jpg

also tried changing {{now}} and {{wartungsende.wartungsvertrag bis}} at creating and comparing the variable, same result, no effect. could it be, because theres a space in {{wartungsende.wartungsvertrag bis}} ?

Alex Koxaras Community Leader Aug 19, 2022

No, space is not the issue. Did you enter a value in your field within an issue?

Like Andreas Dellmour likes this

I changed .....toDate.plusDays(7)}} to .....toDate.plusDays(10)}} 
So the date with 27.08.2022 is in the range from today +10.

Laptop.jpg

{{JiraDate.match("((\d{2})\/(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\/(\d{2}))$").toDate.plusDays(10)}}

Alex Koxaras Community Leader Aug 19, 2022

I think that you have to change your comparison to:

FIRST FIELD: {{jiraDate.match("((\d{2})\/(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\/(\d{2}))$").toDate}}

SECOND FIELD: {{now.plusDays(10)}}

If I understand correctly you want to be notified if the insight object date is equal to today's date +10 days (meaning that in 10 days from now, the object's date will expire).

Like Andreas Dellmour likes this

I want to get an e-mail, when the objects date +10 days is todays date or after.
and I want the rule to run everyday at 8 in the morning.

And the e-mail should contain every object that falls under this condition.

But it won't trigger as i want it to :(
I think the variable is always empty,... in the log is also only the mail listed, but no object-id...

Alex Koxaras Community Leader Aug 19, 2022

@Andreas Dellmour for the rule to run you have to place it inside a project.

Within this project you have to create at least an issue and then populate your wartungsende field (click and choose from the dropdown) with the specific object. You have to create X issues which all will have a separate value from the Laptop object. You have 45 laptop object and therefore you have to create 45 issues in your project. Every issue has have on the wartungsende a unique value.

After doing that you have to modify your rule a bit more like the following:

schedule.png

You can enable your rule and click run rule to test it If everything goes according to plan you may have a similar audit log:

resultsss.png

In the above image take a closer look and see that ONLY for the kox-3 issue an email was sent! This is because I have place a value on my CDI field only on that issue. For all other issues (kox-1, kox 2 and kox 4) no email was sent.

Like Andreas Dellmour likes this
Alex Koxaras Community Leader Aug 19, 2022

A look on my issue @Andreas Dellmour :

issue my.png

Like Andreas Dellmour likes this
Alex Koxaras Community Leader Aug 23, 2022

@Andreas Dellmour did it worked out for you?

Like Andreas Dellmour likes this

I'm a little bit challenged in creating an issue,... :(
and combining it with the defined insight variable

@Alex Koxaras It's now working, thank you very much! :)

Like Alex Koxaras likes this
Alex Koxaras Community Leader Aug 24, 2022

Glad to know that!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS

Atlassian Community Events