I am attempting to create a PUBLIC VF page that includes a Screen Flow.
The user will access via a url such as https://theurl.com.au/12314125235532235242 where 12314125235532235242 is a hash of the id. Within URL rewrite, it is transformed to https://theurl.com.au?id=0031231ewe2324 where 0031231ewe2324 is the contact id.
I need to pass either 12314125235532235242 or 0031231ewe2324 to the flow as I need that to record the information in the screen flow against the contact record.
Using Getting the URL parameter into Lightning component using the "{! paramName}" expression I was able to get it to function if I hard code the details.
.js file - this works
({
init : function (component) {
var flow = component.find("flowData");
// flow.startFlow("CASE_Advice_Fee_Subsidy");
var inputVariables = [
{
name : 'varId',
type : 'String',
value : '30ddf5a99e460a8994f422e2faed93f5250e7994ddcb20587162d0ea9087bb97'
}
];
flow.startFlow("CASE_Advice_Fee_Subsidy", inputVariables);
}
})
.js file - this doesn't work The only change is the attempt to get the url parameter 'id'
({
init : function (component) {
var flow = component.find("flowData");
// flow.startFlow("CASE_Advice_Fee_Subsidy");
var inputVariables = [
{
name : 'varId',
type : 'String',
value : component.get("v.pageReference").state.id
}
];
flow.startFlow("CASE_Advice_Fee_Subsidy", inputVariables);
}
})
.cmp
<aura:component
implements="flexipage:availableForAllPageTypes, lightning:availableForFlowActions, lightning:isUrlAddressable"
access="GLOBAL">
<aura:handler name="init" value="{!this}" action="{!c.init}" />
{!v.pageReference.state.id}
<lightning:flow aura:id="flowData" />
</aura:component>
.vfp
<script>
$Lightning.use("c:embedFlowInExternalWebsiteApp",
function() {
$Lightning.createComponent(
"c:embedFlowInExternalWebsite",
{ },
"lightningLocator",
function(cmp) {}
);
},
'https://domain.cs127.force.com'
);
</script>