Hello,
Need to create a jira automation to send a scheduled email of all the ideas that have a project target in set number of days, but since it's not a jira field I'm only able to search for a specific date not if "x number of days left.
Any idea how?
Hi @Sahar Qarem .
Important to note Jira dates follow a specific date (and time) formatting like:
"YYYY-MM-DD"
JPD dates follow a range formatting like:
"{\"start\":\"YYYY-MM-DD\",\"end\":\"YYYY-MM-DD\"}"
Because of the difference - JPD date-fields are not fully supported with automations, and also do not have the same filtering / JQL capabilities like Jira date-fields.
Having said that, I think your use case may still be possible if we manipulate the JPD date-field through smart values, and compare it to a date or another field. Below is an example of this.
1) WHEN: Scheduled (select when this automation should be scheduled to run)
2) THEN: Create variable
{{issue.customfield_XXXXX.substringBetween("\"start\":\"","\",\"end\"")}}
*3 / 4) These steps can be disregarded, and were simply used for logging purposes to troubleshoot and debug throughout testing
5) IF: {{smart values}} condition (aka "Compare two values")
6) THEN: Send Slack message (or email user(s) / preform some other action)
Step 2 converts my JPD Project target field from a range, into a variable with the formatting of yyyy-mm-dd. This is done using string processing.
Step 5 then compares the variable to the present date + 5 days from now (future date so to speak), and if these two dates match - the automation sends a message to Slack.
Here is the Audit log tab of this automation through some testing:
I'm not sure this is the "perfect" way to do this, but I hope it helps and can reference when configuring your automation!
Hi Nick,
I've tried it, and it's not working. I've used the log and it shows as attached.
maybe the smart value format is missing something?
{{issue.customfield_10152.substringBetween("\"start\":\"","\",\"end\"")}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Sahar Qarem ,
It would be very helpful if you could post the log action result of the custom field "{{issue.customfield_10152}}". This will allow us to see the value structure. The next step would be to process this value using automation smart values to extract the information you need.
Regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Alaa,
I've logged it and getting the same and Project Target above, (no result, empty)
I've executed the JQL below:
Project=XM AND "project target"~"2024-07-12" ORDER BY cf[10152] DESC, Created DESC
Where, "Project Target" is the custom field used in "order by" as well.
How can i search JQL using smart values?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Sahar Qarem ,
One thing to verify is the Scheduled trigger of your automation. You need to use a JQL search to define the set of issues that the rest of the automation will run on by checking "Run a JQL search and execute actions for each issue in the query".
This could be a JQL search that filters and returns only the issues corresponding to all the ideas that have a project target. You can validate the search query without running the automation, check how many issues are returned, and even click on the link to display the search results.
Regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @ALAA EDDINE ROUCADI ,
I've executed the JQL below:
Project=XM AND "project target"~"2024-07-12" ORDER BY cf[10152] DESC, Created DESC
Where, "Project Target" is the custom field used in "order by" as well.
How can i search JQL using smart values?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Sahar Qarem ,
Unfortunately, as far as I know, in JPD context, the project start/target date is a relatively new and complex structure that is not supported by JQL (including using smart values)
One approach could be to filter, at the Scheduled trigger level, for ideas with a target date using a query like:
Project=XM AND 'project target' is not empty ORDER BY cf[10152] DESC, Created DESC.
Then, follow the steps described by @Nick Haller HERE. For each returned issue, the automation will:
Start date: {{issue.customfield_10152.match("start\":\"([0-9-]+)\"").first}}, End date: {{issue.customfield_10152.match("end\":\"([0-9-]+)\"").first}}
PS:There will be one notification sent per issue fulfilling the condition.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @ALAA EDDINE ROUCADI ,
The log expression is still coming back empty for some reason, but adding the JQL query the at the "scheduled" trigger worked and the rule is executing correctly now.
Thank you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Community,
We were able to get this resolved through a support ticket using an automation like the one below - which can send a daily email of all ideas if their JPD date-field matches the present day:
1) WHEN: Select schedule for automation to run
2) THEN: Lookup issues - JQL:
project = XYZ AND cf[00000] ~ "\"end\":\"{{now.jiraDate}}\""
^ cf[00000] is the JPD date-field's ID. Can find this using this doc:
3) AND THEN: Send email - which uses the Lookup issues from previous step to list all ideas in email body using this:
{{#lookupIssues}} * {{key}}, {{summary}} - {{url}} {{/}}
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 @Sahar Qarem ,
Important to note Jira dates follow a specific date (and time) formatting like:
"YYYY-MM-DD"
JPD dates follow a range formatting like:
"{\"start\":\"YYYY-MM-DD\",\"end\":\"YYYY-MM-DD\"}"
Because of the difference - JPD date-fields are not fully supported with automations, and also do not have the same filtering / JQL capabilities like Jira date-fields.
Having said that, I think your use case may still be possible if we manipulate the JPD date-field through smart values, and compare it to a date or another field. Below is an example of this.
1) WHEN: Scheduled (select when this automation should be scheduled to run)
2) THEN: Create variable
{{issue.customfield_XXXXX.substringBetween("\"start\":\"","\",\"end\"")}}
*3 / 4) These steps can be disregarded, and were simply used for logging purposes to troubleshoot and debug throughout testing
5) IF: {{smart values}} condition (aka "Compare two values")
6) THEN: Send Slack message (or email user(s) / preform some other action)
Step 2 converts my JPD Project target field from a range, into a variable with the formatting of yyyy-mm-dd. This is done using string processing.
Step 5 then compares the variable to the present date + 5 days from now (future date so to speak), and if these two dates match - the automation sends a message to Slack.
Here is the Audit log tab of this automation through some testing:
I'm not sure this is the "perfect" way to do this, but I hope it helps and can reference when configuring your automation!
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.