Here we will setup the trigger on record create event.
We will be doing it like this: If a new account is created, its activation status value will be "Queued to Activate". And after a day, the account will get activated. In this timespan, the finance team can have a look at the account.
I know this is possible in the workflow as well as the process builder and in apex too. But now let's try it in the flows.
Follow the given steps to get the motive done.
1) Let's create a field on the account object named "Activation Status". You can make it read-only so that no one will be able to set the value directly to "Activated".
Activation Status field will be of type picklist with values "Queued to Activate" and "Activated".
2) Let's create a new Record-Triggered flow, and configure it.
For the trigger, select "A record is created" and after the record is saved.
You can try with before the record is saved, this way one DML operation will be decreased and the system gets a step closer to the optimized one.
3) Select object also, so that flow will get triggered when the new record is created.
4) At the start, we need to configure the scheduled path, it's similar to workflow's time-dependent action and process builder's Scheduled Actions.
Configure it, so that it will get executed exactly after a day.
There is another path too, the default one.
5) Now add update records to the "Run Immediately" path. In this, set the field "Activation_Status__c" as "Queued to activate".
6) Now add another Update Record element so that we can update the field after a day.
We cannot test this flow as it is time-dependent.
We can but we need to wait at least one hour to see the change in the field as the minimum time interval should be 1 hour.
Comentarios