I'm trying to have an if statement that runs if a date/time picker value, "Last Status Change" is after the start of today's date. This was my most recent attempt:
{{#if(now.toDateTimeAtStartOfDay.isBefore("Last Status Change"))
Test
{{/}}
This permutation has errors, but I've tried dozens of different variations and I'm out of ideas. I think this is just the cleanest psuedocode example for showing what I'm trying to do. I've also tried getting a diff between "now" and "Last Status Change" but it would appear blank.
Any thoughts or suggestions would be appreciated.
Hi @Delaney Bannon -- Welcome to the Atlassian Community!
Is "Last Status Change" a custom field you have added and which is a date / time type field?
If so, please try this:
{{#if(now.toDateTimeAtStartOfDay.isBefore(issue.Last Status Change))}}Test{{/}}
You will need to confirm the exact smart value (or custom field ID) to use for your field for the expression to work.
That may be done using this how-to article: https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/
Kind regards,
Bill
Hi Bill, thanks for the response. It set me on the right track. I found the code that runs properly. For anyone else's benefit, it ended up being:
{{#if(now.toDateTimeAtStartOfDay.isBefore(customfield_xxxxx))}}
Test
{{/}}
It doesn't work with issue.Last Status Change, issue."Last Status Change", or any other variation.
And to make a correction, I figured out the source of the error which was a missing {{/}} at the end of the statement.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well done!
Smart values are name, spacing, and case-sensitive, and frequently do not exactly match the field's display name on the issue pages. When an incorrect one is used, that returns as null. And even when the correct smart value is used, some are not supported and the custom field ID must be used in rules.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've been learning that over the past few days. I'm curious if there's a fast way to write something and see what it would output. Since I've been setting up an automated email my method has been to edit the email body and then schedule it for a minute or two from the current time. It's a bit slow for a test case. Any other suggestions or should I make a separate question?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Certainly! To do that, please try the Log action: https://support.atlassian.com/cloud-automation/docs/jira-automation-actions/#Log-action
I often start many rules like this to test-as-I-go:
With that, I can rapidly experiment to get the expression working...and it doesn't consume a rule "usage" count because the rule does nothing actionable. When it works as needed, I change the trigger and incrementally add actions / conditions to experiment further until done.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.