# Platform Events

## **Intro**

Limio can send notifications of subscription orders and changes to Salesforce via **Salesforce Platform Events**. These events can be transformed using [**Salesforce Flows**](https://help.salesforce.com/s/articleView?id=platform.flow_builder.htm\&type=5) to populate relevant data in Salesforce, whether in standard objects like **Opportunities** or custom objects. This allows you to build a **360˚ view of the subscribers**, bringing in your Limio data alongside your existing Salesforce data.

**Common use cases include:**

* Notifying agents or salespeople of new orders or subscription changes.
* Bringing data into Salesforce to enable campaign or sales reporting.
* Creating leads or updating opportunities to align with Sales-assisted processes.

For example, you could create a list of subscription events into a custom object, which can then be used as the basis for **provisioning Entitlements from Salesforce.**

<figure><img src="https://3950144701-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKxTpA9AeeNYx1ml6UpHj%2Fuploads%2FREi64xr2QwG560mShd01%2Fimage.png?alt=media&#x26;token=2d69ed99-24c2-442a-aa99-50ec8b886b8f" alt=""><figcaption></figcaption></figure>

Advanced use cases can also involve creating data in Salesforce or calling specific APIs or Apex classes to populate Salesforce or external systems.

## Prerequisites

Before setting up Salesforce platform events with Limio, ensure the following prerequisites are met:

1. **Your Limio instance is linked to your Salesforce org.** If you haven't yet, follow this [guide](https://docs.limio.com/integrations/populating-salesforce-data/connect-limio-salesforce#id-1.-write-data-from-limio-to-salesforce) to connect Limio to Salesforce.
2. **Salesforce Order V3 Plugin is enabled in Limio.** This plugin is what send data from Limio Commerce to Salesforce. Learn more about it [here](https://docs.limio.com/integrations/populating-salesforce-data/limio-updates-salesforce).
3. **For this guide, you'll need Salesforce Admin access.**
   * It's also preferable to have some working knowledge of Salesforce Lightning Flows and Platform Events. However, we'll make sure to walk you through the setup step-by-step if you haven't used them before.

## How to activate the feature

At a high-level, once the feature is activated, you'll need to subscribe to the Platform Event and insert the record into a Salesforce object, such as an Asset or an Opportunity. Two options:

A. If you are using **Limio for Salesforce**, the platform event and a platform event-triggered flow are predefined for you. To activate them:

1. Request the Limio team to enable the **Salesforce Order V3 Plugin**.
2. Customise the template flow called **Listen to Limio OrderEvent\_\_e** to align with your business logic.

B. If you are **not** using **Limio for Salesforce**, follow these steps:

1. **Create a custom event**
   * Name the event **Order Event Custom (Order\_Event\_Custom\_\_c)**.
2. **Add custom fields to the event**
   * Refer to this [Limio guide](https://docs.limio.com/integrations/populating-salesforce-data/platform-events-flexible/platform-events-definitions) for the list of fields Limio can populate.
3. **Contact Limio Support**
   * Request **Salesforce Order V3 Plugin** to be configured to send **Salesforce Platform Events**.
   * Provide the **API Name** of your platform event \*\*(\*\***Order\_Event\_Custom\_\_c)** along with the **API Names** of the custom fields you created.

For detailed, step-by-step instructions, please refer to our [**comprehensive guide**](https://docs.limio.com/integrations/populating-salesforce-data/platform-events-flexible/setup-platform-events).

## How to map Limio data to my Salesforce data via Platform Events & Flows

Now that you have activated **Salesforce Platform Events** and they are coming from Limio into Salesforce, you will now want to map them to your data. You can use **Salesforce Lightning Flows** to map Limio Platform Events to your Salesforce data. This will allow you to take a Limio Order, transform it via Flows and populate a Salesforce object.

<figure><img src="https://3950144701-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKxTpA9AeeNYx1ml6UpHj%2Fuploads%2FmXjOeqP32dTT1ItHkudi%2Fimage.png?alt=media&#x26;token=12398ae5-914e-4003-8ad2-552440ab39f7" alt=""><figcaption></figcaption></figure>

Limio also has a [standard Flow](https://docs.limio.com/integrations/populating-salesforce-data/platform-events-flexible/orderevent-flow) that can help you to map with no-code the Salesforce Platform Events:

<figure><img src="https://3950144701-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKxTpA9AeeNYx1ml6UpHj%2Fuploads%2Fvoa4QJ71Oq9qBcvYekWt%2Fimage.png?alt=media&#x26;token=1c703446-3d4f-4adf-bb3b-f5499c98e2ec" alt=""><figcaption></figcaption></figure>

You can see the full list of events and the associated data Limio sends for different order types, go to: [platform-events-definitions](https://docs.limio.com/integrations/populating-salesforce-data/platform-events-flexible/platform-events-definitions "mention")
