Skip to content

Instantly share code, notes, and snippets.

@jsmithdev
Created June 17, 2019 06:44
Show Gist options
  • Save jsmithdev/cf18daae1580800f41ff8d67dec3677e to your computer and use it in GitHub Desktop.
Save jsmithdev/cf18daae1580800f41ff8d67dec3677e to your computer and use it in GitHub Desktop.
Get parameter from URL and pass into a flow via lightning component.
<aura:component implements="lightning:isUrlAddressable,flexipage:availableForAllPageTypes,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
<aura:handler name="init" value="{!this}" action="{!c.init}"/>
<lightning:flow aura:id="flowData" />
</aura:component>
({
init : function (component) {
// Find the component whose aura:id is "flowData"
const flow = component.find("flowData");
const params = location.search; //equates to ?uid=003V000000rHMuJIAW
// Part of the query => ?uid=003V000000rHMuJIAW to 003V000000rHMuJIAW
const uid = params.substring(5, params.length)
const inputVariables = [
{
name : "ContactId",
type : "String",
value: uid
}
];
// In the component whose aura:id is "flowData, start your flow
// and initialize the account sObject variable. Reference the flow's
// Unique Name.
flow.startFlow("FLOW_API_NAME", inputVariables)
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment