# Workflow not displaying the correct year on date

Hi,
I have created a workflow to take a date and one month on. The workflow correctly pulls in the day and month but is not showing the correct year, it is showing as 2020 instead of 2021.

The formula is:
Date One - {addMonths(d-m-Y; {P0}; 1)}
Date two - {addMonths(d-m-Y; {P0}; 2)}
etc.

Anyone have an idea why this might be happening?

Also, I am trying to calculate a monthly payment based on taking 80% of the total fee and dividing it by 15 months.

I tried this: - {multiply({divide({P0}; 15)}; 0.8)}

but it just returns a ‘0’.

Any help if greatly appreciated.

Many thanks

Hey,

Are you still having issues with this?

I’m unable to replicate the first issue, when giving it a try in 7.11.18
It seems to be carrying onto Jan 2021, if I have a Date in November + 2 Months

What version of SuiteCRM are you on by chance?

Is there anything custom about the fields you are using?
(ie: Custom Module / Fields added in studio)

In regards to your calculation, should the operators perhaps be swapped, like?:
{divide({multiply({P0}; 0.8)};15)}

As this would then do:
(80% of {P0} ) / 15

Currently it looks like it is working as:
( {P0} / 15 ) * 0.8

Which would give a totally different result
(Unless that is actually the calculation you’d like to perform, in which case, disregard that )

Hi John,

Many thanks for your reply, I really appreciate your help. Yes, I am afraid I have not solved the date issue.

The field is a custom field on the opportunity module. It is a standard date field.

The calculation produces the correct day and month, it is just the year that remains as 2020.

Incidentally, the date is displayed as 01-02-20, (intending to be {P0} start date of 1st January 2021 + 1 month) and not 01-02-2020 (with the full year displayed).

What is also strange is that the formula to count the ‘16th’ payment date, (i.e. {PO} + 16 months, {addMonths(d-m-Y; {P0}; 16)} displays correctly as 01-05-2022 and I simply cannot work out why.

In regards to the calculation your proposed formula works - thank you. To now multiply this by a further parameter {P1}, where would this sit in the formula?

Do I need to replicate the entire multiply section?

My version of Suitecrm is 7.10.18

Thanks again

Hey,

I’ve given it a try again with custom fields, but it still works for me I’m afraid…

• What is the initial value of your Date, before you try to add 1 or 2 months?
(And, in what Date/Time format?)

• You mention that it works for the +16 months formula.
Is there a difference in the field used for this, compared to the one in which it does not work?
(ie: Field Type / Stock or Custom Field / etc)

• Could you provide a screenshot of your Workflow’s “Calculate Fields” section, if that’s alright?
It may be handy in seeing how it is all laid out

I’d like to try to replicate it as close to your scenario as possible

Regarding the formatting of “01-02-20”,
I’d typically expect this to happen if the formula is using a lowercase “y”, as opposed to uppercase
But, the formula you have provided has an uppercase “Y”

So, I’m not too sure why it would display as “01-02-20”

Perhaps it is worth checking what Date format is being used in the CRM?

Regarding the Calculation,

If you want to Multiply the value by {P1}, I think you can just wrap it in another *{multiple xxxx} * parameter

Maybe something like:
{multiply({divide({multiply({P0}; 0.8)};15)});{P1}}

So it would work out as:
( (80% of {P0} ) / 15 ) * {P1}

Is that what you’re looking for?

As an Aside, I’d recommend upgrading, (if you feel comfortable doing so), as there has been a large number of fixes between 7.10.18->7.10.29
(Both General & Security)

Anyways, let me know how things go