Use Salesforce flows in Context Panel#

Context Panel supports Salesforce Lightning components, allowing users to access and interact with Salesforce directly from their email client. You can also embed Salesforce flows in the Context Panel by rendering them inside Lightning web components (LWC) or Aura components.

What are Salesforce flows?#

Salesforce flows is a point-and-click automation tool that helps you build interactive workflows without writing code.

Flows can:

  • Collect and validate user input

  • Create or update Salesforce records

  • Trigger notifications or follow-ups

  • Guide users through structured processes

Common use cases:

  • Screen flow – guide a sales representative through entering lead or opportunity data

  • Record-triggered flow – automatically update records when specific changes occur

  • Scheduled flow – run periodic follow-ups or reminders

Embedding flows in the Context Panel allows users to run these workflows directly from their inbox, reducing context switching and manual updates.

Embed a flow in a Lightning component#

To display a flow in the Context Panel, you must wrap it in one of the following:

Embed a flow in a Lightning web component#

If your implementation uses Lightning web components, use the <lightning-flow> base component to render the flow.

Basic example#

<!-- flowContainer.html -->
<template>
    <lightning-card title="Flow">
        <lightning-flow flow-api-name={flowName}>
        </lightning-flow>
    </lightning-card>
</template>
// flowContainer.js
import { LightningElement } from "lwc";

export default class FlowContainer extends LightningElement {
    flowName = "Your_Flow_API_Name";
}

Replace Your_Flow_API_Name with the API name of your flow.

Pass input variables (optional)#

If your flow requires input, pass variables to the flow using the flow-input-variables property.

<!-- flowContainer.html -->
<template>
    <lightning-card title="Flow">
        <lightning-flow
            flow-api-name={flowName}
            flow-input-variables={inputVariables}
            onstatuschange={handleStatusChange}>
        </lightning-flow>
    </lightning-card>
</template>
// flowContainer.js
import { LightningElement, api } from "lwc";

export default class FlowContainer extends LightningElement {
    @api recordId;
    @api userId;

    flowName = "Your_Flow_API_Name";

    get inputVariables() {
        return [
            {
                name: "RecordId",
                type: "String",
                value: this.recordId
            },
            {
                name: "UserId",
                type: "String",
                value: this.userId
            }
        ];
    }

    handleStatusChange(event) {
        if (event.detail.status === "FINISHED") {
            // Add post-flow logic here (for example, refresh data or show a message)
            console.log("Flow finished");
        }
    }
}

Use input variables to prefill data and reduce manual input during flow execution.

Embed a flow in an Aura component#

If your implementation uses Aura, use the <lightning:flow> component to render and start the flow.

Basic example#

<!-- flowContainer.cmp -->
<aura:component>
    <aura:handler name="init" value="{!this}" action="{!c.init}"/>
    <lightning:flow aura:id="flowData"/>
</aura:component>
// flowContainerController.js
({
    init: function (component, event, helper) {
        const flow = component.find("flowData");
        flow.startFlow("Your_Flow_API_Name");
    }
})

Replace Your_Flow_API_Name with the API name of your flow.

Pass input variables (optional)#

If your flow requires input, pass variables when starting the flow.

<!-- flowContainer.cmp -->
<aura:component>
    <aura:attribute name="recordId" type="String"/>
    <aura:attribute name="accountId" type="String"/>

    <aura:handler name="init" value="{!this}" action="{!c.init}"/>
    <lightning:flow
        aura:id="flowData"
        onstatuschange="{!c.handleStatusChange}"/>
</aura:component>
// flowContainerController.js
({
    init: function (component, event, helper) {
        const flow = component.find("flowData");

        const inputVariables = [
            {
                name: "OpportunityId",
                type: "String",
                value: component.get("v.recordId")
            },
            {
                name: "AccountId",
                type: "String",
                value: component.get("v.accountId")
            }
        ];

        flow.startFlow("Your_Flow_API_Name", inputVariables);
    },

    handleStatusChange: function (component, event, helper) {
        if (event.getParam("status") === "FINISHED") {
            // Add post-flow logic here.
            console.log("Flow finished");
        }
    }
})

The name value for each input variable must match the API name of the corresponding input variable in the flow.

Next steps#

After embedding the flow in a Lightning component, configure the component so it can be used in the Context Panel: