+ Start a Discussion
JsinghroyJsinghroy 

Cloud Flow Designer Date add function

Good Morning,

 

I am have a issue with setting date in a variable field to be 30 days in the future. When setting up a date in salesforce I need to have the flow choose a date 30 days in the future and update the custom object. The object is a managed field and i cannot update the default value of the object so it must be done in the flow.

 

The frustrating part is that the flow only gives you the option for {!$Flow.CurrentDate}.  in Sales force it would be easy with today() + 30. in other applications I would have some form of DATEADD.  

 

does anyone know how I can accomplish to set the date 30 days in the future? I am not a developer but an analyst building a flow.

 

Thank you

BenjKBenjK

I'm having a similar problem -- I need to calculate:

 

newDate = dateInVariable - X days

BenjKBenjK

I ended up writing a lightweight Apex plugin to do the date calculations.

markross__cmarkross__c

After hammering away at this for a while, I came up with a solution.

 

Go ahead and populate the variable with the Current Date, which you should be able to do in your Date Update or Allocation. 

 

You can then write a normal workflow rule in Salesforce that goes off whenever a new record is created for that object. (I gave myself further insurance that this will only go off when created by the Flow by making a checkbox called "Generated by Flow" and having the Data Update push a TRUE value to it.)

 

Then use a normal workflow field update to affect the date field in question using normal formulas.

Kenneth AndersenKenneth Andersen
I just wanted to chime in here since I stumbled on this while brushing up on my flow knowledge. I had the same problem with flows, but now you have the option to select a formula instead of a varible. This will allow the TODAY() + 30 formula or anything else you can imagine using the formula builder. No need for workflow, Apex, or workarounds anymore.
Curt D EnsignCurt D Ensign
Thanks Kenneth for that answer. 
TifaTifa
Worked like a charm Kenneth! Thank you!
Goose__cGoose__c
What Tifa said.