# Pass Custom Tracking IDs in Checkout Links

## Overview

As a Salesforce admin working with Limio for Salesforce, you can now inject custom metadata directly into the order payload using the new **Record Ids to add to the order tracking object** property in the **Initiate Checkout** flow component. This allows you to:

* Pass Salesforce record IDs such as Opportunity or Quote IDs into Limio.
* Enable downstream integrations or analytics.
* Track orders in SF more effectively by attaching reference markers to the resulting platform event.

***

## What is **Record Ids to add to the order tracking object**?

The **Record Ids to add to the order tracking object** property enables you to append custom tracking data to the order payload during checkout.

<figure><img src="/files/kfFjaO5eAT8yb4jiRLTx" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/2Dj3ea6ZBEHT0NpoXkxo" alt=""><figcaption></figcaption></figure>

***

## How to configure `customTracking` in a Salesforce Flow

1. **Open your flow:** Open the relevant Flow in **Flow Builder** where the **Initiate Checkout** component is used. This is often inside a screen called “Generate Checkout Link”.
2. **Add a formula resource:** Create a **Formula Resource** that outputs a JSON string. For example:

   `"{\"opportunityId\": \"" & {!Opportunity.Id} & "\", \"userId\": \"" & {!$User.Id} & "\"}"`

   💡 This step ensures dynamic merge fields are properly included in the final payload.
3. **Set the** `customTracking` **property:**
   * Navigate to the **Initiate Checkout** component.
   * In the **customTracking** property, assign the formula created above.
4. **Save and activate the flow:** After testing, activate the updated flow to make the changes live.

## What happens at checkout?

* The JSON is parsed and injected into the `tracking` field of the order payload.
* The data is visible in Limio Commerce as part of the order object.
* This metadata is also published in the platform event, which can be consumed by external systems.

## Example: tracking Opportunity ID

Here is a basic example that tracks an Opportunity ID and the agent submitting the flow:

`"{\"opportunityId\": \"" & {!recordId} & "\", \"submittedBy\": \"" & {!$User.Email} & "\"}"`

This would result in an order payload like:

`{ "tracking": { "opportunityId": "0068X00001A123B", "submittedBy": "agent@example.com" } }`

## Retrieving tracking data from the platform event

When the Salesforce V3 plugin is enabled to publish platform events, Limio will emit a platform event for each processed order. This event—published by Limio Commerce—can be subscribed to in Salesforce to trigger post-checkout automation, such as updating the related Opportunity or Quote record.

The event published by Limio is of type `i42as__OrderEvent__c`. Within the flow triggered by this event, you can access the `i42as__LimioOrder__c` field. This field contains a full JSON representation of the order payload—including the `tracking` object you defined earlier in your flow.

You can then parse this JSON string in your platform event-triggered flow to extract relevant tracking values, such as:

* `opportunityId`
* `quoteId`
* `submittedBy`

These values can be used to locate and update Salesforce records as needed. For example, you might update the related Opportunity's stage once the Limio order is marked as `complete`.

This approach ensures a seamless integration loop—from initiating the checkout with context, to processing the response and reflecting updates in Salesforce.

## Error handling

* If the JSON string is malformed, the component will show an error in the flow UI.
* Ensure that:
  * All keys and values are enclosed in double quotes.
  * Quotes inside the formula are escaped using `\"`.
  * Merge fields are correctly referenced and evaluated.

***

## Related articles:

[Listen to OrderEvent Flow](/integrations/populating-salesforce-data/platform-events-flexible/orderevent-flow.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.limio.com/integrations/using-limio-for-salesforce/generate-checkout-link/custom-tracking-ids.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
