Workflow - how to add months in Date field and store at another field

Hello,

We are trying to create a workflow such that it will store value for field when it will add date field and number of months from another field.

It is set to run:always | run on: Modified records | Repeated runs: yes

What is wrong in the actions? How to do it? We have given months in {{ }} brackets.

Example: {{number}}

That’s not how it works. Calculated fields cannot be added directly to the field. You have to first calculate the value.

2 Likes

It is not able to calculate new date.

{addMonths(format; timestamp; amount)}

{addMonths(Ymd; {P0}; {P1})}

The format “Ymd” has to match exacly your db value how it stores it. This would work for a date field but not a date time filed. Also in your screen shot, you’re not using the calculated field, your using just a normal field. Like in my screen shot you have to choose “Calculated Fields”

Also what have you set the variables P1 and P0 to be?

In DB, it is yyyy-mm-dd

Yes, I am using Calculated Fields

P0 = Date in yyyy-mm-dd(in DB)
P1 = number of months

You’re also missing a closing bracket.

Also the P1 MUST be a date field, not a date/time.

You’re also missing proper brackets around the other variables.

You’re date is definately not formatted properly.

Read the documentation and follow the syntax careflully. It absolutely works.

1 Like

You are correct! The format value was wrong. We corrected it and now it is showing a date.

{addMonths(Y-m-d; {P0}; {P1})}

Example: {addMonths(format; timestamp; amount)}

We were trying Ymd but it should be Y-m-d

Assuming your timestamp is “now”, you could also use the {Now(Ymd)} calc too.