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

Eric Bergeron May 26, 2022

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
Yanty Ghani [ServiceRocket]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 27, 2022

Hi @Eric Bergeron ,

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

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

 Hope that helps.

Eric Bergeron May 27, 2022

Hello @Yanty Ghani [ServiceRocket] , 
 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}}{{/}}

Yanty Ghani [ServiceRocket]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 27, 2022

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

Eric Bergeron May 27, 2022

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).

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 27, 2022

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

Eric Bergeron May 27, 2022

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.

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 27, 2022

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.

Eric Bergeron May 30, 2022

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 [ServiceRocket] 

Like # people like this

Suggest an answer

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

Atlassian Community Events