0

I have a Record - Triggered flow , and I need to make a condition on a custom field type Date , the condition is to verify if the date is modified make a another custom field is false and make this , the problem I have is I need to verify if the date is changed to another in future not in the past of the previous value .

For exemple :

The actuel date is : 02/06/2023 I changed the date to 03/06/2023 => In this situation make the field is false but if I changed to 01/06/2023 The value of the field should not be changed .

How Can I verify this condition (Change of date in the future) .

4
  • Use before record triggered flow and create formula what will return Date comparing $Record.DateField__c and TODAY() Jun 2, 2022 at 11:09
  • 1
    also, in order to prevent changing a field you can set previous values which is accessible via $Record__Prior.DateField__c Jun 2, 2022 at 11:28
  • @Oleksandr Berehovskyi , I used your proposition and it worked for me , thank you Jun 2, 2022 at 13:27
  • @Oleksandr Berehovskyi , I accept it . thank you Jun 2, 2022 at 13:30

2 Answers 2

1

You can use $Record__Prior global flow variable, in order to get original value before change.

create a formula, which will return value, which should be set

IF($Record__Prior.DateField__c < TODAY(), $Record__Prior.DateField__c, $Record.DateField__c)

and set this value in assignment DateField__c = FORMULA_ABOVE

0

You may be able to create a custom formula field on your record with the value: checkbox. This would not require a flow.

The formula you use for this field could be:

IF(DateField__c>TODAY(), true, false)

This would be a constant formula, so if the date the DateField__c was changed to is no longer greater than today, it will revert back to false.

To keep this in a flow, you can create a path with a few decisions, ultimately leading to updating the checkbox.

enter image description here

In a nutshell, it would look like the following:

  • Start Flow - Record Triggered on object
  • Decision 1 - Was the Date Changed?
  • Decision 2 - Is the new Date Greater than Today()?
    • Action if true - Update checkbox to true
    • Action if false - Update checkbox to false

Decision 1:

enter image description here

Decision 2:

enter image description here

Decision 2: Create Formula for 'TODAY()' to use in value field of Decision 2.

enter image description here

The actions should be straightforward 'Update Record' actions where the checkbox is set equal to 'true' under the true path of Decision 2 or set to false under the false path.

Then just save, activate, and test that it works as you want!

If this has been helpful, please mark as the best answer so it may help others. Thanks!

4
  • Re-reading your post, I think I set the true and false values backward in my example, but just swap the two Update Record actions in the 2nd decision path and you should be good to go. Jun 2, 2022 at 13:01
  • thank you for your help , your explication also , but in my case I want to compare the previous date with the new value Jun 2, 2022 at 13:25
  • I used the solution proposed by @Oleksandr Berehovskyi to compare the previous value with the new one Jun 2, 2022 at 13:28
  • I used also the logic of @Alexis Frisch , thank you for you both . Jun 2, 2022 at 13:29

You must log in to answer this question.

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