Wait Element in Salesforce Flow (With Real-Time Example) : Bijay Kumar

Wait Element in Salesforce Flow (With Real-Time Example)
by: Bijay Kumar
blow post content copied from  SalesForce FAQs
click here to view original post



### Summary of Content on Salesforce Flow's Wait Element This article explains how to use the "Wait Element" in Salesforce Flow, which is a tool that allows users to delay actions for specific records based on time, date, or conditions. The wait element is particularly useful for handling scenarios like sending reminder emails for unpaid invoices without affecting all records. #### Key Points: 1. **Scheduled Trigger Flow**: Used to automate actions for multiple records at a fixed time (e.g., daily email reminders for unpaid invoices). 2. **Wait Element**: This element pauses the flow for a specific time, until a certain date, or until a specific condition is met before executing further actions. This helps to customize flows for individual records. 3. **Types of Wait Element**: - **Wait for Amount of Time**: Pauses for a fixed duration (e.g., 3 days). - **Wait for Conditions**: Pauses until a specified condition is met (e.g., a manager's approval). - **Wait Until Date**: Pauses until a specific date or time. #### Use Cases: - **Example 1**: For invoices, if an invoice is created with a status of "Unpaid," the flow waits for 3 days. If still unpaid, a reminder email is sent, and the invoice status is updated. - **Example 2**: In a hiring process, after a candidate is marked as "Offer Pending," the flow waits for the manager's approval before sending an offer letter and updating the status. #### Steps to Create a Scheduled Trigger Flow: 1. Navigate to Setup in Salesforce and create a new flow. 2. Set a start date and time for the flow. 3. Retrieve all unpaid invoices using the "Get Records" element. 4. Use the "Wait for Amount of Time" to pause the flow. 5. After the wait, send an email and update the invoice record. #### Conclusion: Understanding the wait element in Salesforce Flow enhances automation by allowing actions to be deferred or contingent upon specific conditions being met. This flexibility is essential for managing workflows effectively, especially in complex business processes. ### Additional Information: - Always debug your flow before activation to ensure accuracy. - The wait element can significantly reduce unnecessary immediate actions by allowing for a more thoughtful timing of tasks. ### Hashtags for SEO: #SalesforceFlow #WaitElement #Automation #SalesforceTutorial #CRM #BusinessAutomation #ProcessAutomation #SalesforceTips #EmailReminders #InvoiceManagement #WorkflowAutomation


We use a scheduled trigger flow when we want to perform an action for multiple records at a fixed time, such as sending daily reminder emails for all unpaid invoices.

But what if we want to wait 3 days after one specific invoice is created before taking any action? In that case, we need to pause the process for just that one record, not for all.

This is where we can use the wait element to pause the process until a specific time, date, or condition is met. After that, it will get executed and perform actions such as sending a reminder email, creating a task, or updating a field.

In this article, we will learn about how to use the wait element in Salesforce Flow. In this section, I will explain what a wait element is, when it can be used, its different types, and provide a real-time scenario with a step-by-step explanation.

What is the Wait Element in Salesforce Flow?

The wait element in Salesforce Flow is used to pause the flow for a specific amount of time, wait until a date, or wait for a condition to be met, before continuing to the next steps.

It allows you to delay actions, such as sending emails, updating records, or assigning tasks, instead of executing them immediately when the flow starts.

This is useful when you want to wait for a few days until a specific date is reached or until a field value changes without needing to schedule a separate flow.

Different Types of Wait Element in Salesforce Flow

Below are the different types of wait elements in Salesforce Flow. After that, we will examine the real-time use case and how we can utilize type in flow to fulfill the case requirements.

  • Wait for Amount of Time: Waits for a fixed time, such as 2 days or 3 hours.
  • Wait for Conditions: Pauses the flow until a field changes to meet a specific condition.
  • Wait Until Date: Waits until a specific date or time comes.

When we use these elements, any automation we want to perform will be paused until the specified time according to the wait element, after which it will be executed.

Use the ‘Wait for Amount of Time Element’ in Salesforce Flow

Below, I will explain the use case and how we can create and utilize the ‘Wait Amount of Time‘ element in Salesforce Flow to automate the process according to our requirements.

The ‘Wait for Amount of Time’ element allows us to pause the flow for a specified duration, such as a few minutes, hours, days, or months. We can also choose to resume the flow at a specific time of day after the wait is over.

Use Case:

Suppose a company has a custom object called Invoice__c to create the invoice. Whenever an invoice is created with Status = ‘Unpaid’, we want to:

  • Wait for 3 days, and if the invoice remains unpaid, send a payment reminder email to the customer and update the invoice to indicate that the reminder has been sent.

So here the delay is based not on a specific field, such as a Due Date, but on a fixed amount of time after the invoice is created, which is ideal for the wait element’s “Wait for Amount of Time” option.

Create a Schedule Trigger Flow in Salesforce

I will now explain the flow and demonstrate the proof of concept for the working flow.

Navigate to the setup, and in the Quick Find box, search for ‘Flows’ under Process Automation.

In the flows setup window, click on the button New Flow. Select the option Schedule-Triggered Flow, and click Create.

Select the Start Date and Start Time for the schedule of the trigger flow. After this, select the frequency from the options OnceDaily, and weekly.

Wait Element in Schedule Trigger Flow

Next, we need to retrieve all the invoices stored in the Invoice__c object. For that, we need to add the Get Records element and enter a Label and API Name.

Then, to filter the invoice records, add a condition. Here, I set the status to ‘Unpaid’ and ‘Reminder Sent’ to ‘False’.

Due to these filter conditions, we retrieved only those records that met the defined criteria.

Get Records in Salesforce Flow

After that, we added the ‘Wait for Amount of Time‘ element. Using this, even if the flow trigger and all conditions are met to fulfill the requirement to proceed to further automation, the wait element pauses the flow until the specified time comes.

So here we provided the label and API name for the wait element. After that, in the right-side dropdown field, we can select the amount of time we want to pause the flow, such as Minutes, Hours, Days, or Months.

In the Amount of Time field, we can define a specific number. Until we reach the selected amount, whether it’s a minute or something else, the flow will not proceed to further action.

In our use case, we want to send a reminder email after 3 days of invoice creation, but due to the show flow execution, I have selected 5 Minutes. That means when the invoice gets created, it will not get sent immediately; instead, it will be sent after 5 minutes.

Wait Element in Salesforce Flow

Additionally, we have a ‘Resume at a specific time of day’ option in the Wait element. This is an optional feature that allows us to choose the time of day the flow should continue after the waiting time is complete.

It allows us to control the timing of tasks such as sending emails, creating tasks, or updating records, ensuring these actions occur during business hours.

Use Wait Element in Salesforce Flows

After that, we want to send an email once the wait is over. For that, add the Send Email action.

Here you need to select the field values to send an email, such as sender email, subject, body, recipient address, etc.

In the body, we inform the customer that their bill remains unpaid and the outstanding amount. Whatever you want to send as a customer template, you can send.

Send Reminder Email Using Salesforce Flow

After sending an email to the customer, we need to update the record to show that the reminder was sent and also update the status field.

To do this, add the Update Record element, providing a Label and API Name. After that, select the object for which you want to update the fields or record.

Then, in the Set Fields Values for the Invoice Records option, we need to select the Fields from the invoice element and assign a value.

Update Record After Wait Element in Salesforce Flow

Now we are ready to save the flow. For that, click the Save button, provide the flow Label, and the API Name will be automatically populated.

After that, always debug the flow before activating it to ensure that the working flow is correct and that there are no runtime errors. Then activate the flow.

Wait Element in Salesforce Flows

Proof of Concept:

After activating the flow, navigate to the Candidate Profile tab to create a new record. Additionally, we need to set the Status field to ‘Unpaid‘ according to the condition defined in the flow.

In the image below, you can see the date and time when the record was created. It was created at 10:57 am. If we create the record trigger flow for this, the email will be sent immediately.

However, using the Wait element, we have paused the flow until the specified time is up, and we add 5 minutes of waiting to proceed with further action.

Salesforce Flow Wait Element

After 5 minutes of invoice creation, which means at 11:02 am, you can see that at that time, the customer receives an email with the message we added to the body.

Send Email Alert Using Wait Element in Salesforce Flow

Additionally, after sending an email, we update the fields, which are also updated in the invoice record.

Salesforce Flows Wait Element

In this way, we can utilize the “Wait for Amount of Time” element in Salesforce flow to pause the flow for a specified period.

Use the ‘Wait for Condition’ in Salesforce Flow

Now, we will understand the ‘Wait for Condition’ element in Salesforce flow, its real-time use case, and how we can utilize it to fulfill automation requirements.

The wait for conditions element allows the flow to pause until specific conditions are met or a particular event occurs, rather than continuing immediately.

Use Case:

Suppose a MNC company has a multi-step hiring process using a custom object called Candidate Profile__c, and once a candidate is selected:

  • HR sets the application status to ‘Offer Pending’.
  • The manager must approve the offer by checking the ‘Manager_Approved__c’ field.
  • Once approved, an offer letter is automatically sent to the candidate’s email.
  • After that, the Status should automatically change to Offer Sent.

Create Auto-launch (No Trigger) Flow

To create the flow, go to Setup -> in Quick Find search for ‘Flows‘ -> click the New Flow button -> select Start From Scratch -> Autolaunch Flow(No Trigger) -> Create.

First, create a Variable named ‘recordId‘ to get the candidate profile ID from the Apex class because we will invoke this flow from Apex. Then, ensure that the ‘Available for input’ checkbox is checked.

Create recordId Variable in Salesforce Flow

Next, we need to retrieve all the candidates stored in the Candidate Profile__c object. For that, we need to add the Get Records element and enter a Label and API Name.

Then, to filter the invoice records, add a condition. Here, I set the ID to ‘recordId'(created variable).

Since we retrieve the record from the Apex class and apply these filter conditions, we have only retrieved those records that meet the defined criteria.

Fetch Data Using Get Records Element in Salesforce Flow

After that, we need to wait for the manager’s approval. If there is manager approval, the process will proceed; otherwise, it will not.

For that, we need to add the ‘Wait for Conditions‘ element because here we will wait until the manager’s permission is granted.

After adding the element, provide the Label and API Name to the element. Add the condition: when the condition is met, proceed to further action.

Get the manager-approved field from the Get Record element set to True. That means the manager approved the candidate.

Add Wait For Condition Element in Salesforce Flow

Then, in the RESUME EVENT and within the specified time frame, the manager should approve the candidate.

Resume Event in Wait Element in Salesforce Flow

Now we are ready to save the flow. For that, click the Save button, provide the flow Label, and the API Name will be automatically populated.

After that, always debug the flow before activating it to ensure that the working flow is correct and that there are no runtime errors. Then activate the flow.

Wait For Condition Element in Salesforce Flow

After activating the flow, we need to call the autolanch flow from the Apex class. For that, go to the Setup -> Developer Console -> New Apex Class -> provide a class name and call the flow.

In the class, you can see that we provided the candidate ID variable to the recordId (Flow variable).

public class WaitElementFlowLauncher {
    
    public static void launchOfferFlow(Id CandidateId) {
 
        if(CandidateId == null) {
            throw new IllegalArgumentException('Job Application Id cannot be null');
        }

        Candidate_Profile__c rec = [SELECT Id, Status__c FROM Candidate_Profile__c WHERE Id = :CandidateId LIMIT 1];
 
        if (rec.Status__c != 'Offer Pending') {
           System.debug('Flow not started because status is not Offer Pending.');
           return;
        }

        Map<String, Object> flowInputs = new Map<String, Object>{
            'recordId' => CandidateId
        };

        Flow.Interview.Use_Decision_Element_in_lows flowInterview =
            new Flow.Interview.Use_Decision_Element_in_lows(flowInputs);

        flowInterview.start();

        System.debug('Flow launched for Job Application: ' + CandidateId);
    }
}

Then we need to provide the Candidate ID so that it will be assigned to the recordId variable and passed to the auto-launch flow.

As you click the Execute button and the record you have created in the Candidate Profile object, if the Manager Approved checkbox is not checked, it means the manager has not approved that candidate.

If the manager didn’t approve the wait element, pass the flow until the manager’s approval is granted. Once the manager approves, the wait will be over, and further action will be executed.

Call Auto launch Flow From Apex Class in Salesforce

Proof of Concept:

In the image below, you can see that the candidate received an email with the values we provided in the Send Email action.

Send Email in Wait For Time Salesforce Flow

Also, the status is updated in the candidate profile record.

Salesforce Flow Wait For Condition Element

In this way, we can use the Wait for Condition element in Salesforce flow, so that the flow pauses until the condition becomes true, and then further actions will be executed.

Conclusion

I hope you have got an idea about how to use the wait element in Salesforce Flow. I have explained what a wait element is, when it can be used, its different types, and provided a real-time scenario with a step-by-step explanation.

You may like to read:

The post Wait Element in Salesforce Flow (With Real-Time Example) appeared first on SalesForce FAQs.


June 20, 2025 at 07:07PM
Click here for more details...

=============================
The original post is available in SalesForce FAQs by Bijay Kumar
this post has been published as it is through automation. Automation script brings all the top bloggers post under a single umbrella.
The purpose of this blog, Follow the top Salesforce bloggers and collect all blogs in a single place through automation.
============================

Salesforce