Find your content:

Search form

You are here

Using Flow (Visual Workflow), is it possible to increase a custom date field by adding 'x' days in an assignment?

 
Share

I would like to use a Flow to perform a record update and increase a custom date field on a record by 365 days. In a good old SFDC formula field, you can do this easily by using a simple date formula like "custom_date__c + 365" and the date value will increase by 365 days.

Is it possible to do this using an Assignment in a Flow by updating the date from the record which is stored in a Flow variable?

FYI: the Flow needs to update the record because it will trigger or re-evaluate certain Workflow rules that are part of the custom logic/process so a WF field update or formula really won't work within the process context.

  • The Flow is invoked through a custom button on record detail page.
  • The custom date field is passed into the Flow through the URL and stored in a Flow variable.

Attribution to: Steve Richardson

Possible Suggestion/Solution #1

You can simply use record update and in filed value choose create new and formula. In the formula box write the below formula:

{!$Flow.CurrentDate} +30

Attribution to: Balaji Velaga

Possible Suggestion/Solution #2

I was able to accomplish this with the Assignment element. I did however have to read the custom date field within the Flow via the Lookup element, rather than passed in through a URL (any reason why you needed to do that?). I did try passing in the Date as you described in your question, but I got an internal Salesforce error. However I have achieved what you wanted I believe, here is how...

I created this flow...

enter image description here

And called it with this URL (from a Custom Button, behaviour no sidebar or header)...

/flow/namespace/UpdateDateBy365?RecordId={!Test__c.Id}&retURL=/{!Test__c.Id}

Using the Record lookup element I populated the DateToIncrease variable...

enter image description here

Using the Assignment element I increased it by 365...

enter image description here

Finally, using the Record Update element I updated it...

enter image description here

The reminder of the Flow simply displays the resulting value, when the user clicks the Finish button it redirects back to the URL passed in the 'retURL' parameter above.


Attribution to: Andrew Fawcett
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/4026

My Block Status

My Block Content