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,299,083
Community Members
 
Community Events
165
Community Groups

Increase one Date field from two customs fields: date + numerical (without a script)

Edited

Hello, 
I would like to know if it's possible to update the date of the Due Date field, based on the date from one custom field + the numeric value found in a custom field. 

In other words: 
DateField1 = DateField2 + NumField3
(the NumField3 is actually a listbox with choice of 4 numbers. It is unclear if the value is considered string or numerical)

I tried using the smart value function .plusDay() as below but it does not work. 
{{issue.CustomField_10088.plusDays(CustomField_10090)}}

Thank you all

1 answer

1 accepted

0 votes
Answer accepted

Hi @Eric Bergeron ,

Welcome to Atlassian Community! Can you please try this one?

{{issue.CustomField_10088.plusDays(issue.CustomField_10090)}}

 Hope that helps.

Hello @Yanty Ghani , 
 thank you for the (fast) welcome! 

I had tried that one you suggested, but it's a no go. 
Also attempted to use the math smart values in this fashion, without success (very wishful) : 
{{#=}}{{issue.CustomField_10088}} + {{issue.CustomField_10090}}{{/}}
{{#=}}{{issue.CustomField_10088.days}} + {{issue.CustomField_10090}}{{/}}

I tried on mine and it works. Instead of using CustomField_10088 and CustomField_10090, can you use the actual field's name?

I did previously try the text name of the fields, no go. 

Perhaps the issue comes from the fact that the NumField3 is a listbox

I've just added/changed the issue description with the following: 
(the NumField3 is actually a listbox with choice of 4 numbers. It is unclear if the value is considered string or numerical).

Hi @Eric Bergeron 

As your field is a single-select, perhaps try adding the value attribute.

{{issue.customfield_10088.plusDays(issue.customfield_10090.value)}}

If that does not work, also add .asNumber

Kind regards,
Bill

Hi @Bill Sheboy 
Any dotAttribute does not work on my end. Not sure if these attributes need to be activated somewhere(?)

It does not work.

Eric, when you note "it does not work", what are you observing?

The attributes should work out-of-the box.  For a single-select field:

  • just the smart value returns the displayed value for the dropdown
  • .value also shows the display value
  • .value.asNumber provides the display value as a number if it is a valid number

I just tried this with a custom, single-select field and it worked for me (with a different custom field id).  Perhaps try writing this to the audit log and describe what happens.

{{issue.customfield_10088.plusDays(issue.customfield_10090.value.asNumber)}}

 

Also please note my correction to capitalization, as smart values are case-sensitive.

Like Yanty Ghani likes this

Bill, 
Seems like I wasn't using both ".value" and ".asNumber" together, which is needed for the function .plusDay on a date field ( the customfield_10088). 

customfield_10090 itself, gave out the right number selected;
customfield_10090.value also gave out the right number selected;
but then used in the .plusDays  function, nothing was being printed into my test text field, and Audit Log was successful. 

You're above line, with capitalization, worked! 


Thank you @Bill Sheboy  and @Yanty Ghani 

Like # people like this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you