You can customize how and where users can resume their interviews by embedding the lightning-flow component in a custom LWC component.
To use this component, build a flow with the Salesforce Flow Builder first. The component includes the navigation buttons Back, Next, Pause, and Finish.
If your flow has custom Lightning web components or Aura components, then you can’t use lightning-flow on Experience Cloud sites that use Lightning Web Runtime.
Note
Handle Paused Interviews
By default, users can resume interviews that they paused from the Paused Interviews component on their home page. To customize how and where users can resume their interviews, embed the lightning-flow component in a custom LWC component and pass the interview ID into the flow-interview-id attribute.
This example shows how you can resume an interview, or start a new one. When users click Survey Customer from a contact record, the lightning-flow component does one of these actions.
If the user has any paused interviews for the Survey Customers flow, the lightning-flow component resumes the first one.
If the user doesn’t have any paused interviews for the Survey Customers flow, the lightning-flow component starts a new one.
Example: Use Apex to Resume or Start a New Interview
This Apex controller gets a list of paused interviews by performing a SOQL query. The query returns a null value if there are no paused interviews, and then the component starts a new interview. If the query returns at least one interview, the component resumes the first interview in that list.
1// InterviewsController.apex2public class InterviewsController{3 @AuraEnabled(cacheable=true)4 public static String getPausedId(){5 // Get the ID of the running user.6 String currentUser = UserInfo.getUserId();7 // Find all of that user’s paused interviews for the Survey customers flow.8 List<FlowInterview>interviews =9[ SELECT Id FROM FlowInterview WHERE CreatedById = :currentUser AND10 InterviewLabel LIKE '%Survey customers%'];11 if(interviews == null || interviews.isEmpty()){12 return null; // early out13}14 // Return the ID for the first interview in the list.15 return interviews.get(0).Id;16}17}
If the Apex controller returns an interview ID, the pausedInterviewId passes to the flow-interview-id attribute. If the Apex controller returns a null interview ID, the component starts a new interview by passing the flow name to the flow-api-name attribute.
1// myComponent.js2import{LightningElement, wire}from "lwc";3import getPausedId from "@salesforce/apex/InterviewsController.getPausedId";45export default class MyComponent extends LightningElement{6 flowName;7 pausedInterviewId;89 @wire(getPausedId)10 getPausedInterviewId({error, data}){11 if(error){12 // start a new interview since no interview id was returned.13 this.flowName = "Survey_customers";14}else if(data){15 // resume the flow with the returned interview id.16 this.pausedInterviewId = data;17}18}19}