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

Automate Post Fungtion set Field value (Date Picker) by JMWE

Hi Guys,

 

I have fields :

- Start date (Date Picker) 

- End date (Date Picker)

- Additional days Overdue (select list (Single choice)), ex : 3,7,14,21

 

what I need to set "End date" value from post fungtion, if I set "Start date" and "Additional days Overdue".

for exsample : I set "Start date"= 20/07/2022 and "Additional days Overdue"= 7 than post fungtion automate set "End date" value =27/7/2022

 

Please help me, what can I do In post fungtion ( I used Addons JMWE)

 

Regards,

Tyas

2 comments

Alessandro Lombardo
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.
Jul 20, 2022

I don't remember very well JMWE but I think you should define the variable startDate maybe in this way:

def startDate = issue.getcustomfieldvalue(Start date)

and then you add days like this:

End date =startDate.plus(Additional days Overdue)

It is not the right code, but the logic should be that. You should have automatic completion with that plugin

Dear Alessando,

 

Thanks for your respont,

 

Regards,

Tyas

David Fischer _Appfire_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Jul 20, 2022 • edited

Hi @Hana IT PMO ,

you can add a Set Issue Fields post-function, configure it to set the End date field, and use this as the value:

{{ issue.fields["Start date"] | date("add", issue.fields["Additional days Overdue"], "days") | date("yyyy-MM-DD") }}
Like Hana IT PMO likes this

Hi David,

 

the script not work, End date value just copy value from Start date

 

and I try change hange "add" to number (ex:7) and input start date 21-07-2022

{{ issue.fields["Start date"] | date("7", issue.fields["Additional days Overdue"], "Days") | date("yyyy-MM-DD") }} 

the result is 2001-07-01

 

Regards,

Tyas

David Fischer _Appfire_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Jul 20, 2022

Hi Tyas,

The syntax I provided is correct. But you must make sure the field names are exactly as they appear in the Cudtom Fields page. The safest is to use the Issie Fields help tab under the editor to insert a reference to the fields using the field ID instead. 

Also, what is the field type of the Additional days Overdue field?

Hi David,

 

Additional days Overdue filed type is select list (Single choice) with value 3,7,14,21

 

Regards,

Tyas

David Fischer _Appfire_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Jul 21, 2022

That explains it - my code assumed the field was a number field.

In that case:

{{ issue.fields["Start date"] | date("add", issue.fields["Additional days Overdue"].value, "days") | date("yyyy-MM-DD") }}

I recommend you use the "Issue Fields" help tab when trying to access an issue field's value.

Like Hana IT PMO likes this

Dear David,

 

the script work, using your first script

{{ issue.fields["Start date"] | date("add", issue.fields["Additional days Overdue"].value, "days") | date("yyyy-MM-DD") }}

 

second  script not work, it have ".value" 

thanks for your help,

 

Regards,

Tyas 

Comment

Log in or Sign up to comment