Calculate a date field from another date field using workflow calculated fields

Hello,

I am trying to calculate a ‘series’ of payment dates from another date field using the calculated fields in a workflow. In my module I have a ‘start date’. I then want to calculate the following fields automatically on saving the record.

Payment 1 date = start date
Payment 2 date = start date + 1 months
Payment 3 date = start date + 2 months
Payment 4 date = start date + 3 months
Payment 5 date = start date + 4 months

etc.

In my layout I have created fields for Payment 1 date, Payment 2 date etc., based on the ‘data type’ being set to ‘date’, (but I am not sure if this is correct or whether I should be using a different data type as we do not want the calendar date picker). We want this date to be populated automatically on saving the record.

I have tried the following but it does not populate the fields.

I have created an action in my workflow as follows:

Parameters: Start Date Raw value {P0}

Action:

Formula - field name: Payment 1 date

{addMonths(dmY; {P0}; 1)}

Can anybody help and let me know what I am missing here/doing incorrectly?

Thank you.

Suitecrm v7.8.8

You’re using a very old version… you might be hitting bugs that were already fixed…

This sort of hack sounds like you should be doing what you want in a logic hook, not in a workflow, because in PHP you wouldn’t need to set fields like this, you would just do the calculation on the spot.

But anyway, do you want to add the fields to any view? Or are they just auxiliary fields? I mention this because the date-picker issue is irrelevant if you don’t add the fields to views.

The first thing I’d try is to play with date formats. Try setting your date in english format to see if the calculated formula works.

1 Like

Many thanks @pgr. It was an error in my set up. It is all working as it should.