---
title: "Using Salesforce Workflow Rules to update fields based on OnceHub data"
description: "The OnceHub connector for Salesforce allows you to map any OnceHub System field or Custom field to Salesforce fields."
url: "https://help.staticso2.com/scheduleonce/account-integrations/crm/salesforce/using-salesforce-workflow-rules-to-update-fields-based-on-oncehub-data"
---

The OnceHub connector for Salesforce allows you to map any OnceHub System field or Custom field to Salesforce fields. If you want to add an additional layer of Salesforce fields update logic, you can [create Salesforce Workflow Rules](https://help.salesforce.com/articleView?id=workflow_rules_new.htm\&type=5).

In this article, you’ll learn how to create Workflow Rules based on OnceHub data. We’ll use a sample scenario in which you update the **Lead: Event Booked** **checkbox** and the **Lead: Lead Status picklist** when a Customer makes a booking or reschedules a booking.

## Requirements

[Section titled “Requirements”](#requirements)

To update Salesforce fields when the Customer schedules or reschedules an event, you will need:

* A [OnceHub Administrator](https://help.staticso2.com/account-administration/user-management/user-roles-overview "Differences between Administrator and Member").
* A Salesforce Administrator for your organization.
* [An active connection to your Salesforce API User](https://help.staticso2.com/scheduleonce/account-integrations/crm/salesforce/connecting-salesforce-api-user "How to connect a Salesforce API User").

Let’s assume that the Lead Status field includes the **Working – Contacted** and the **Open – Not contacted** options. To create the Salesforce Workflow Rules, you’ll need to follow these steps:

* Create an **Event Status** text Custom field for the Lead object and add it to the Lead Page Layout.
* Create an **Event Booked** checkbox Custom field (unchecked as default) for the Lead object and add it to the Lead Page Layout.
* Map the OnceHub **Status** field to the Lead: Event Status field.
* Create the Workflow Rules.

## Creating an Event Status text Custom field

[Section titled “Creating an Event Status text Custom field”](#creating-an-event-status-text-custom-field)

1. Sign in to Salesforce as [your API user](https://help.staticso2.com/scheduleonce/account-integrations/crm/salesforce/connecting-salesforce-api-user "How to connect a Salesforce API User").

2. Go to the **Setup** page.

3. In the **Platform Tools** section, go to **Objects and Fields → Object Manager** (Figure 1). ![Object Manager - Workflow Field update in Salesforce](https://help.staticso2.com/_astro/1566990756726.BSlW8oVx_Z15PiVJ.png)Figure 1: Object Manager in the Objects and Fields menu

4. In the **Object Manager** list, select **Lead** (Figure 2). ![Object Manager - Lead - Salesforce Workflow Rule](https://help.staticso2.com/_astro/1567090640217.BHjrTlT5_Z1PpNYk.png)Figure 2: Lead in the Object Manager list

5. Select **Field & Relationships → New** (Figure 3). ![Lead - Salesforce Update Field](https://help.staticso2.com/_astro/1569239556616.DVof-SFi_zqJ2Y.png)Figure 3: Fields & Relationships

6. In the **New** **Custom Field** pane, select **Text** and click **Next** (Figure 4). ![](https://help.staticso2.com/_astro/1569239698638.DuQit4Fx_Z1n8IIQ.png)Figure 4: Text field

7. In **Step 2: Enter the details**, enter the following information (Figure 5). Add a description if required, then click **Next**.

   * **Field label:** Event Status
   * **Length:** 40
   * **Field Name:** Event\_Status **![](https://help.staticso2.com/_astro/1569241468597.00zPVTpO_ZWUKKh.png)Figure 5: Step 2 Enter the details**

8. In Step 3, click **Next**.

9. In Step 4, click **Save**.

Your **Event Status** text Custom field is now created and is added to the Lead Page Layout.

## Creating an Event Booked checkbox Custom field

[Section titled “Creating an Event Booked checkbox Custom field”](#creating-an-event-booked-checkbox-custom-field)

1. Follow steps 1–5 from Creating an Event Status text Custom field above.

2. In the New Custom field pane, select **Checkbox** and click **Next** (Figure 6). ![](https://help.staticso2.com/_astro/1569245388085.DhjB6mZL_ZGmzOf.png)Figure 6: Checkbox

3. In **Step 2: Enter the details**, enter the following information (Figure 5). Add a description if required, then click **Next**.

   * **Field label:** Event Booked
   * **Default value:** Unchecked
   * **Field Name:** Event\_Booked ![](https://help.staticso2.com/_astro/1569245924790.DKJalsyq_1ipC8A.png)Figure 7: Step 2 Enter the details

4. In Step 3, click **Next**.

5. In Step 4, click **Save**.

Your **Event Booked** checkbox Custom field is now created and is added to the Lead Page Layout.

## Mapping the OnceHub Status field to the Lead Event Status field

[Section titled “Mapping the OnceHub Status field to the Lead Event Status field”](#mapping-the-oncehub-status-field-to-the-lead-event-status-field)

1. Select your profile picture or initials in the top right-hand corner → **Profile settings** → **CRM**.

2. In the Salesforce box, click **Setup**.

3. In the **Salesforce connector** **setup**, go to the **Field mapping** tab.

4. At the bottom left of the table, click **Add OnceHub fields** (Figure 8). The OnceHub field list includes System fields and Custom fields organized by categories.

5. The **Add OnceHub fields** pop-up will open

6. Use the **Filter by** drop-down menu to filter by **Booking data**.

7. Check the **Status** checkbox.

8. Click **Add fields**.

   Note

   **Note**If you want to make the Workflow Rule specific to a [Booking page](https://help.staticso2.com/scheduleonce/event-types-booking-pages/booking-pages/introduction-to-booking-pages "Introduction to Booking pages") or [Event type](https://help.staticso2.com/scheduleonce/event-types-booking-pages/event-types/introduction-to-event-types "Introduction to Event types"), you can also map the OnceHub Booking page label or Event type name to specific Lead Custom fields. The Booking page label or Event type name can be used to refine the Salesforce Workflow rule that is triggered when a booking is made.

9. For the newly added **Status** field, select **Lead** from the first drop-down menu and select **Event Status (Event\_Status\_\_c)** from the second drop-down menu (Figure 8). ![](https://help.staticso2.com/_astro/1569246544449.BnAS6WYo_Z2uMXmH.png)Figure 8: Map the Status field

10. Click the **Save** button or **Save and Continue** if you have completed mapping all fields.

## Creating Workflow Rules in Salesforce

[Section titled “Creating Workflow Rules in Salesforce”](#creating-workflow-rules-in-salesforce)

You can automate the update of many field records using workflow rules. We will create two workflow rules:

* **Workflow rule 1** checks the **Event Booked checkbox** and sets the Lead Status to **Working - Contacted** when the event is scheduled or rescheduled by Customer
* **Workflow rule 2** unchecks the **Event Booked checkbox** and sets the Lead Status to **Open – Not Contacted** when the event is not scheduled or rescheduled by Customer

To create Workflow rules, follow the steps below:

1. Sign in to Salesforce.
2. In your Salesforce **Setup** page, go to **Platform tools → Process Automation**.
3. Select **Workflow Rules** (Figure 10). ![](https://help.staticso2.com/_astro/1568109555419.BCeFcDr6_1rvPGK.png)Figure 9: Workflow Rules
4. Click **New Rule**.
5. From the **Object** drop-down, select the object to which the rule will apply. In our example, select **Lead**.

### Creating Workflow Rule 1

[Section titled “Creating Workflow Rule 1”](#creating-workflow-rule-1)

1. On the **New Workflow Rule page** in Salesforce, fill out the following information and click **Save & Next** (Figure 11).

   * **Rule Name**: Update Lead fields when event is scheduled or rescheduled by Customer

   * **Rule description**: The Rule checks the **Event Booked** checkbox and sets the Lead Status to **Working - Contacted** when the event is scheduled or rescheduled by Customer.

   * **Evaluate the rule when a record is**: created, and every time it’s edited

   * **Rule Criteria:** Run this rule if the criteria are met:

     * **Lead: Event status** equals **Scheduled**
     * **Lead: Event status e**quals **Rescheduled by Customer**
     * **Advance filter logic:** 1 OR 2 ![](https://help.staticso2.com/_astro/1569247182313.DHa-YoHe_Z1dPcHL.png)Figure 10: Update Lead fields when event is scheduled or rescheduled by Customer

2. On **Step 3: Specify Workflow Actions**, click **Add Workflow Action**.

3. Select **New Field Update** and add the following information (Figure 12):

   * **Name**: Check the **Event Booked** checkbox automatically
   * **Unique name:** Check\_checkbox
   * **Field to update**: Event Booked
   * **Re-evaluate Workflow Rules after Field Change:** Checked
   * **Checkbox Options:** True ![](https://help.staticso2.com/_astro/1569247401796.2uGeIBUh_Z1W9Wum.png)Figure 11: Automatically check the Event *Booked* checkbox

4. Click **Save & New**.

5. Add the following information (Figure 13):

   * **Name**: Update the Lead Status picklist to Working - Contacted
   * **Unique name**: Update\_the\_Lead\_Status\_picklist
   * **Field to update**: Lead Status
   * **Re-evaluate Workflow Rules after Field Change:** Checked
   * **Picklist Option > A specific value:** Working – Contacted ![](https://help.staticso2.com/_astro/1569247798369.CHUVuQIW_Z14HdDm.png)Figure 12: Update the Lead Status picklist to Working - Contacted

6. Click **Save**.

7. Click **Done**.

8. On the **Workflow Rules** page, click **Activate** to activate the rule.

### Creating Workflow Rule 2

[Section titled “Creating Workflow Rule 2”](#creating-workflow-rule-2)

1. On the **New Workflow Rule page** in Salesforce, fill out the following information and click **Save & Next**.

   * **Rule Name**: Uncheck the **Event Booked** checkbox automatically when a booking is not scheduled or rescheduled by Customer.

   * **Rule description**: The **Event Booked** checkbox will be automatically unchecked on the Lead Page Layout when an event is not scheduled or rescheduled by the Customer for that record.

   * **Evaluate the rule when a record is**: created, and every time it’s edited

   * **Rule Criteria: Run this rule if the following criteria are met:**

     * **Lead: Event status** not equal to **Scheduled**
     * **Lead: Event status** not equal to **Rescheduled by Customer**
     * **Advance filter logic:** 1 OR 2

2. On **Step 3: Specify Workflow Actions** , click **Add Workflow Action**.

3. Select **New Field Update**, add the following information:

   * **Name**: Uncheck the **Event Booked** checkbox automatically when a booking is made.
   * **Unique name:** Uncheck\_the\_Event\_Booked\_checkbox
   * **Field to update**: Event Booked
   * **Re-evaluate Workflow Rules after Field Change:** Checked
   * **Checkbox Options:** False

4. Click **Save & New**.

5. Add the following information:

   * **Name**: Change the Lead Status picklist to Open - Not Contacted
   * **Unique name**: Change\_the\_Lead\_Status\_picklist
   * **Field to update**: Lead Status
   * **Re-evaluate Workflow Rules after Field Change:** Checked
   * **Picklist Option > A specific value:** Open - Not contacted

6. Click **Save**.

7. Click **Done**.

8. On the **Workflow Rules** page, click **Activate** to activate the rule.

You’re all set! You can now create a test booking in OnceHub to view how the Workflow Rules update your records when a booking is made.
