Skip to content

JavaScript widget

For external sites, use the Three Levers Flow Embed script with FlowIframeEmbed.

  1. Install FlowIframeEmbed in Salesforce and expose FlowIframeEmbed on a Site.
  2. Define window.tlFlowEmbed on your external page.
  3. Load three-levers-flow-embed.js.
  4. The script builds the query string (flow, endUrl, inputVars, and any styling keys), resizes the iframe from frameHeight, and scrolls the parent page to the top of the flow when Next or Finish is clicked.

Note - Site URL path: Use https://your-site.force.com/site-prefix/apex/three_levers__FlowIframeEmbed (namespaced managed-package page), not /FlowIframeEmbed. See Salesforce setup.

Define config before loading the script:

<div id="tl-flow-embed"></div>
<script>
window.tlFlowEmbed = {
embedUrl: 'https://your-site.force.com/site-prefix/apex/three_levers__FlowIframeEmbed',
flow: 'Check_In_Dispatch',
endUrl: 'https://yoursite.com/thanks',
inputVars: ['recordId', 'source'],
params: { recordId: '001xxx', source: 'homepage' },
height: '75px',
heightPadding: 20,
bg: 'F5F3F0',
padding: '0',
primary: 'C75B39',
primaryHover: 'A84A2E',
secondary: '1B2A4A',
scrollOffset: 81,
ease: true,
easeSpeed: 0.2,
lazy: true,
allowedOrigin: 'https://your-site.force.com'
};
</script>
<script src="https://cdn.jsdelivr.net/gh/jason-best/lightning-flow-iframe@v1.2.0/embed/three-levers-flow-embed.js" type="text/javascript"></script>

Or download that same file from the v1.2.0 release. v1.2.0 is the widget that scrolls the page to the top of the flow on Next or Finish.

Source: github.com/jason-best/lightning-flow-iframe

Three Levers hosted copy:

<script src="https://threelevers.com/assets/embed/three-levers-flow-embed.v1.js" type="text/javascript"></script>
PropertyDescriptionRequiredDefault
embedUrlSite URL to three_levers__FlowIframeEmbed (no query string; path /apex/three_levers__FlowIframeEmbed)Yes—
flowFlow API Developer NameYes—
endUrlRedirect URL when flow finishesNo—
inputVarsNames of query params to pass as flow String inputsNonone
paramsObject of values for flow inputs (keys must be in inputVars)No—
containerCSS selector or element id for mount pointNo#tl-flow-embed
heightInitial iframe heightNo75px
heightPaddingExtra pixels added to reported heightNo20
bgColor of the iframe page body. Hex with or without #, a color name, or transparentNopage default
paddingSpace around the flow on the iframe page body. 0, 16, 1rem, or 1rem 2rem. A bare number is pixelsNopage default
primaryColor of Next, Finish, and other primary buttons. Hex with or without #, or a color nameNorust #C75B39
primaryHoverHover color of those buttons. When blank, a darker mix of primary is usedNo#A84A2E when primary is blank
secondaryText and border color of Previous and other secondary buttonsNodark text and gray border
scrollOffsetPixels to keep clear below a fixed header when Next or Finish scrolls the page. Stays on the parent page and is not sent to the iframeNo0
easeSmooth height transitionsNofalse
easeSpeedTransition time in secondsNo0.2
lazyloading=\"lazy\" on iframeNofalse
allowedOriginRestrict postMessage to this originNoall origins

See also: Querystring variables · Finish URL

Older docs used ifc and lighningiFrame.js. That script forwarded full parent query strings and used endurl (lowercase).

Current FlowIframeEmbed requires:

  • flow (API name)
  • endUrl (camelCase)
  • explicit inputVars allowlist
LegacyCurrent
ifc.iframeurlembedUrl
ifc.endurlendUrl
ifc.extraqsparams + inputVars
Auto parent query stringExplicit params only