1

We are using this quite simple formula to calculate and set the end date where we take the current date then add the number of months the user enters (Terms_Other__c). However, it's not firing on the first of the month and leave the field blank. Any ideas how to enhance this formula? We just need Date today + number of months = end date.

DATE(Year({!$Flow.CurrentDate})+floor((MONTH({!$Flow.CurrentDate}) + {!sovOpp.Terms_Other__c}  - 1) / 12) , mod(MONTH({!$Flow.CurrentDate}) + {!sovOpp.Terms_Other__c}  -1, 12) + 1 ,  DAY({!$Flow.CurrentDate}) - 1) 
4
  • What do you have that triggers the flow to run?
    – JaredT
    Sep 6, 2017 at 17:02
  • @JaredT it's autolaunched based on a date field that is coming back from DocuSign - date signed, and the number of months is added by the sales rep
    – gato negro
    Sep 6, 2017 at 18:17
  • So the evaluated date coming from this formula will be used to determine when your sequence of automated emails (sent via a time-based workflow) ends?
    – JaredT
    Sep 6, 2017 at 19:38
  • The problem is that when the flow is launched (once the date is added), it's using the above formula but not returning a date for it on the first of the month (to populate the end date field).
    – gato negro
    Sep 6, 2017 at 20:15

1 Answer 1

0

I suspect your problem is with the part that calculates the day of the month.

DAY({!$Flow.CurrentDate}) - 1

If the current flow day is the 1st then it will try and create a zero date and then things start breaking.

If you aren't too concerned about adjusting the corresponding month you could just wrap it in a MAX. E.g.

MAX(1,DAY({!$Flow.CurrentDate}) - 1)

There are likely other problems with this when the Terms_Other__c modifies the month. E.g. When going from a month with 31 days to February.

1
  • Thanks, I'll give it a try to wrap it, otherwise maybe break down the formula to some other actions for the flow.
    – gato negro
    Sep 7, 2017 at 19:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .