Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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,463,375
Community Members
 
Community Events
176
Community Groups

In automation, how do I change the "due date" field based on a change in another custom date field?

I have an issue with custom field "Start date", and I would like to edit the "due date" field of the same issue based on changes to this Start date. Specifically, if the "Start date" is increased by one week, then I would like the "due date" (which is distinct) to also increase by one week.

I have been trying to create an automation for this, but it seems my smart values are non-functioning. I am using the following set up:

Trigger: When value changes for "Start date"

Condition: key = HR-4044 (to isolate testing to one issue)

Action: Then edit issue field "Due date" to: {{issue.duedate.plusDays(fieldChange.from.diff(fieldChange.to).days)}}

 

The above automation results in no errors but an empty "due date" field... The above underlined smart value seems to be the issue. I have confirmed using a strict number in the smart value works fine (ie {{issue.duedate.plusDays(30)}} ), and I tested some smart values in the description to learn more.

The following smart values in the description...

1. {{fieldChange.from.diff(fieldChange.to).days}}

2. {{now.diff(fieldChange.to).days}}

3. {{fieldChange.from.diff(now).days}}

4. {{now.diff(issue.created).days}}

5. {{fieldChange.from}}

6. {{fieldChange.toString}}

7. {{now.diff(xx).days}}

...create the following result:

1.

2.

3.

4. 0

5. 2022-03-10

6. 17/Mar/22

7. 

So it seems fieldChange.from and fieldChange.to are not being recognized as dates in the smart value scheme {{[date1].diff([date2]).[unit]}}, which I learned from this article.

The field that's being changed, "Start date", is a custom Date Picker field.

...Any advice? If there is no solution via this method I'm trying, is there another method available?

1 answer

1 accepted

1 vote
Answer accepted

Hi @Scott Pelton-Stroud ,

As far as it seems to me the {{fieldChange}} output is not a date and therefore no calculation can be done.

I just manipulated the script of your first attempt to the following:

{{fieldChange.from.toDate.diff(fieldChange.to.toDate).days}}

 

Converting toDate before the diff worked on my site. Please try out. Would be happy to see it working 😉

Best
Stefan

That worked! Thank you very much Stefan :)

Like Stefan Salzl likes this
Stefan Salzl Community Leader Mar 04, 2022

You are welcome 😉🙌🏼

Would you please accept the answer? This marks the question as answered and makes it easier for other users with similar problems to find a solution 😉

Best
Stefan

Like Scott Pelton-Stroud likes this

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events