Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to set date field in automation to other date field value minus 7 days?

Brandon Reames January 4, 2023

Hi All -

I am looking for some help here in an automation. I am clear how to setup the automation to trigger, but the key part I am struggling with is the smart value section for the update to take place. I would like to have a field "Data Received Date" populated based on the value in "Target Completion Date" minus 7 days. 

I should add that I am setting this up within Jira Cloud, specifically in a team-managed project.

Any suggestions?

1 answer

1 accepted

1 vote
Answer accepted
Trudy Claspill
Community Champion
January 4, 2023

Hello @Brandon Reames 

Welcome to the Atlassian community!

In this document...

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/

...take a look at this smart value:

{{[date].plus[Unit]([number])}}

 If you have additional questions, let us know.

Brandon Reames January 4, 2023

Thanks @Trudy Claspill. I reviewed that page previously, but did not see where it would allow me to reference another field to base off the new value minus the 7 business days.

 

I thought something like {{Issue.Target Completion Date.minusDays(7)}} would work, but it did not. 

Trudy Claspill
Community Champion
January 4, 2023

Sorry, I missed that you said "minus" and erroneously directed you to the "plus" function.

In what way did it not work, exactly? Was there information in the Audit Log for the execution of the rule? What information was provided?

If you want additional specific advice, please provide a screen image of your rule, the audit log for an execution of the rule, and the details of the step where you are trying to use the smart value.

To debug an automation rule I recommend that you make liberal use of the Log action.

https://support.atlassian.com/cloud-automation/docs/jira-automation-actions/#Log-action

Use this action to print out to the Audit Log the smart values you are trying to use.

- print the key for the issue you are referencing with your smart value to make sure it is referencing the issue you expect it to reference at that point in the rule.

- print just the value of the field you are trying to reference

- print the value you are attempting to calculate

- print the value of the field you are trying to change, before the step where you try to change it

- print the value of the field you are trying to change, after the step that is supposed to change it.

Like Bill Sheboy likes this
Brandon Reames January 9, 2023

Thanks @Trudy Claspill The debugging information was helpful.  I was familiar with the log for automations, but not about printing info via the log action function.

Initially I was hoping to be able to reference the field "Target Completion Date" field and update the value to 7 days prior. I wasn't able to get something to work by the field name itself, but could do so via the custom field id.  I'd love to figure out why the field name isn't usable yet something like "Target Data Received Date" works fine for another field on that same issue. 

Trudy Claspill
Community Champion
January 10, 2023

To debug why your use of the field name didn't work we would need to see the details of the rule when you were using the field name, and the audit log details for the execution of the rule in that state.

Brandon Reames January 10, 2023

I think I understand the issue. There are two fields, one a global field for Target Completion Date and the other within our team project of Target Completion Date. The global one does not show under the options to select when editing an issue for an automation. Regardless, while testing a separate automation, it produced an error message noting two fields of the same name and being unable to distinguish between the two.

Unfortunately, the existing automation I was working on and highlighted above via log actions, did not produce any errors when trying to print values. It instead would just have no data. This is likely why using the custom field reference works, but the name value does not. 

Thanks again Trudy. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events