Hello,
I am trying to build an automation that sends an email what the story points on a ticket are updated. I have a smart value set up with the current value in the story point field but is there any way to have the old value in the email as well? Would be helpful to know within the email what it changed from.
Thanks.
Hi, @Ben Weisman - yup, just use the fieldChange element.
My sample rule is just sending the info to the audit log, but it's the same format in a rule that uses the email action instead.
Documentation here: https://support.atlassian.com/jira-software-cloud/docs/smart-values-general/
Hi @Ben Weisman
Yes, and...to what Esther suggestions:
Just in case the field was empty (or gets cleared), you could add some default handling. For example, add the pipe symbol followed by a default value of the word EMPTY for the original value:
{{fieldChange.fromString|EMPTY}}
Kind regards,
Bill
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 @Bill Sheboy , I m looking for somewhat similar usecase and i think you should be the right person providing me a solution.
I have a custom date field , I need to use automation which will add a label once any of the member changes the date manually but only for the second time so as to then add the label as Re-Planned , but for all my tries the label is getting added even for the first time when someone selects a date from empty state .(want the label to be added only when its changed second time) Can you please guide me the automation rule here may be using smart values ? Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Vicky S -- Welcome to the Atlassian Community!
First thing: this is a older thread, and so I recommend creating a new question, and perhaps linking back to this one. That will ensure the maximum number of people see it to offer help.
When you create the new question:
Without seeing your rule, your scenario may need adjustments to the conditions or a "counter field" to track the changes. The specifics will depend on your rule and field.
Thanks, and kind Regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Bill Sheboy , here is the new question link - https://community.atlassian.com/t5/Jira-Software-questions/How-to-trigger-automation-action-only-when-the-date-field-is/qaq-p/2659182
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI @Bill Sheboy I am in a company-managed JIRA project.
The custom field "NBIT Release” is having type= Select List (Single Choice)
I tested the rule with a dummy ticket, so when I selected current value as Release 3, got the below result
current value: [Release 3]
length of the value:
and when I cleared the field like then got the below result
current value: []
length of the value:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Troy
Sorry this thread is splitting/scattering. This is one of the reasons why it is better to create your own question and link back to other, related ones: less chance of other questions getting asked in the middle of the discussion :^)
Okay, it appears to me that {{changelog}} is one of those smart values which appears to be dynamically populated, and so doesn't work with all the functions of rules. That makes sense as it is probably filled in just-in-time from the issue history.
So the work-around for this use case is to capture the {{fromString}} first and then use it. For example:
This will return either None or your previous value. Please try that to see how it helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Bill Sheboy thanks for that create variable pointer, working like a charm now :)
I created one more variable to store the current value as well and used the below in my email body:
Previous value: {{#if(varPreviousValue.length().lte(0))}}None{{/}}{{varPreviousValue}}
Current Value: {{#if(varCurrentValue.length().lte(0))}}None{{/}}{{varCurrentValue}}
many thanks for your support mate 👍
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy hope you are well.
Please can you check my query here How do I display previous value of Fix versions fi... (atlassian.com) ? I am hoping you can provide a solution like last time :) Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Troy
I responded to you in the other thread.
Short version for other readers: this is broken and appears to be a known defect which also appears to have a low priority/likelihood of being fixed soon.
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hope everyone having a nice Sunday.
@Ben Weisman thanks for posting this query as this is exactly what I was looking for :)
Thanks for the solution @Esther Strom & @Bill Sheboy
I am using the Send Email trigger and in my email content I have kept as below
Previous value: {{#changelog.Release}}{{fromString|EMPTY}}{{/}}
Current value: {{#changelog.Release}}{{toString|EMPTY}}{{/}}
It is working all fine except when the Release field is cleared, the email content reads as
Previous value: Release 1
Current value:
Is there a way to display None as opposed to blank when the Release field is cleared?
Thanks,
Troy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Troy, and welcome to the Atlassian Community!
You may be able to do that with the rule conditional logic. However there is no "Send Email Trigger", although there is an action for that, and so...
Please post images of your complete rule and the audit log details. Those will provided context for the community to offer ideas.
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your response, Bill.
Please see screenshots below for the complete rule and email action, nothing on the audit log to share :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for that information. As the current value is the one not working, perhaps just use the current value and conditional logic, like this:
Current value: {{issue.NBIP Release}}{{#if(issue.NBIP Release.isEmpty)}}None{{/}}
Both parts appear to be needed when a field has ever contained a value, as it will not be null for default handling in the future.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Bill, I made that changes in the Email content as below
Previous value: {{#changelog.NBIT Release}}{{fromString|EMPTY}}{{/}}
Current value: {{issue.NBIT Release}}{{#if(issue.NBIT Release.isEmpty)}}None{{/}}
But still don't manage to print None against Current value
Previous value: Release 3
Current value:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What is the type of your project: company-managed or team-managed? You may find that at the bottom of the left-side expand panel on the page.
What is the type of that custom field: text, single-select option, etc.?
Knowing that information may help explain what you are observing, as that field appears to contain something which is not empty.
Another thing to test that is to write the following to the audit log:
current value: [{{issue.NBIT Release}}]
length of the value: {{issue.NBIT Release.length()}}
The first one will show what is in the field, surrounded by brackets. If it is not truly empty, something will appear.
The second will be the length of the field, if it is a text field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy
I just stumbled upon this thread and am going through the same issue, but with the Target End Date field (custom field provided by Advanced Plan/Portfolio).
Using {{fieldChange.toString}}{{#if(issue.Target End.isEmpty)}}None{{/}}, I am also not getting "None" but an empty value. I added the suggested test values to the audit log and got:
current value: []
length of the value:
So, it appears the value is empty but the conditional logic is still getting skipped.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Alan, and welcome to the Atlassian Community!
Many of the advanced roadmap fields are not supported by the built-in automation actions yet. Instead you must use JSON to access them, as described in this suggestion: https://jira.atlassian.com/browse/JIRAAUTOSERVER-159
A few things to investigate...
(1) First, smart values are name, spacing, and case-sensitive. So please try this how-to article to confirm you have the correct values: https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/
(2) Next, I wonder if those fields are supported by the fieldChange and changelog values. You may need to test those individually first by writing to the audit log, such as with: {{#changelog.Target End}}{{fromString}}{{/}}
(3) Finally, when you narrow the scope of a smart value expression, such as within the {{fieldChange}} expression, the {{issue}} smart values are no longer visible. So if the smart values are visible in automation, I would try just the current value first, with a single conditional on that value; don't bother looking at {{toString}}
Kind regards,
Bill
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.