Created
June 17, 2019 06:44
-
-
Save jsmithdev/cf18daae1580800f41ff8d67dec3677e to your computer and use it in GitHub Desktop.
Get parameter from URL and pass into a flow via lightning component.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
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