Update a Date field on the record in Flow Builder from the output of a formula date field

flow-builderformulaformula-fieldvisual-workflow

I am new to creating formulas in flows, and just starting to learn flows altogether. I am trying to create a record-triggered flow to update an existing Date field on a record based off the output of a formula date field on the record. The goal is to get the date field called Expected Return ReturnDate__c, to be the next following day after the value from the formula date field called Return End Date ReturnEndDate__c.

ReturnEndDate__c is calculated from 2 other fields (Number field Requested Months RequestedMonths__c) and (Date field called Start Date StartDate__c).

Example
Start Date: 6/1/2022
Requested Months: 2
Return End Date = 7/31/2022

I am trying to get the result Expected Return: 8/1/2022, which should be the next day after the Return End Date. I have tried to creating a formula in the flow but I having trouble figuring out what functions to use to add days to the output for Return End Date field. I have tried using addDays, it doesn't seem to work in flow. Any advice on how I should try to approach this would be very helpful.

Best Answer

Let's assume you have these fields set up in your object:

  • StartDate__c: as Date field
  • RequestedMonths__c: as Number field
  • ReturnEndDate__c: as Formula field (of type Date)

To reach your ReturnEndDate__c you can use the following formula:

ADDMONTHS(StartDate__c, RequestedMonths__c)

Now you can create the field that will be filled by the record-triggered flow:

  • ReturnDate__c: as Date field

Flow set up

In your flow create a formula to calculate the value of the ReturnDate__c field: This will get your ReturnEndDate__c value and add 1 day.

Flow formula

Then create a Update record action that will fill your ReturnDate__c field with the value of the formula:

Flow example

Flow update record


Your end result should look something like this:

enter image description here

Hope it helps!

Related Topic