You need to sign in to do that
Don't have an account?
Nehashri320
Calling flow from Lightning component and passing variable
Hi,
I have written a lightning component and calling a flow from this. It works fine except there is one problem. I am able to pass the record id as a flow variable since that is the flow input variable but there is one more field inside the flow and the flow has a decision node based on that field. If i pass only the Id, the other field inside the flow doenst seem to get the field value even though the field from the same object.
If this is the case how can i pass other field value to the flow along with the id ?
Below are my component and controller:
I have written a lightning component and calling a flow from this. It works fine except there is one problem. I am able to pass the record id as a flow variable since that is the flow input variable but there is one more field inside the flow and the flow has a decision node based on that field. If i pass only the Id, the other field inside the flow doenst seem to get the field value even though the field from the same object.
If this is the case how can i pass other field value to the flow along with the id ?
Below are my component and controller:
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction" access="global" > <aura:attribute name="claim" type="Claim__c"/> <aura:attribute name="claimId" type="Id"/> <force:recordData aura:id="claimRecordLoader" recordId="{!v.recordId}" fields="Submit_to_TPA__c" targetRecord="{!v.claim}" /> <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" var flow = component.find("flowData"); var inputVariables = [ { name : "ClaimIdVar", type : "SObject", value : { "Id" : component.get("v.recordId")} //value : component.get("v.recordId") } ]; // In that component, start your flow. Reference the flow's Unique Name. flow.startFlow("SubmitToTPA", inputVariables ); }, })
for do this, you have need to query the record with there fields using currentrecordId in doInit function:
for reference :
create a apex controller :
update in js controller :
update in component : add controller to component
<aura:component controller="flowCtrl" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction" access="global" >
Let us know if it helps you, and kindly mark it best answer it this answer helps you so it make proper solution for others in future
thanks
All Answers
for do this, you have need to query the record with there fields using currentrecordId in doInit function:
for reference :
create a apex controller :
update in js controller :
update in component : add controller to component
<aura:component controller="flowCtrl" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction" access="global" >
Let us know if it helps you, and kindly mark it best answer it this answer helps you so it make proper solution for others in future
thanks
http://www.sfdcmonkey.com/2017/07/31/lightning-data-service/
Thanks, if it helps you, kindly close your query with choosing best answer so it will remove from unanswered queue :)
http://sfdcmonkey.com
var inputVariables = [{name:'caseIntId', type:'String', value:component.get("v.caseInteractionId")},
{name:'userId', type:'String', value:component.get("v.userId")}];
flow.startFlow(flowId, inputVariables);