+ Start a Discussion
sales force 504sales force 504 

Look up field in lightning Flow

I want to use a existing look up field in a visual flow screen, but as it is not directly available I created a lightning component.
The lightning component workd fine when I embed it into a lightning app, but when I try using it in the flow as a lightning component it prompts with the following error

This page has an error. You might just need to refresh it. Error in $A.getCallback() [An internal server error has occurred Error ID: 1616352317-51606 (-582529140)] Callback failed: aura://ComponentController/ACTION$getComponent Failing descriptor: {flowruntime:flowRuntime}

My component code is as below

<aura:component implements="lightning:availableForFlowScreens" access="global">
    <aura:attribute name="objInfo" type="Contact" 
               default="{ 'sobjectType': 'Contact' }" access = "public"/>
    <force:inputField aura:id="accountid" 
                 value="{!v.objInfo.AccountId}"/>
</aura:component>

Can anyone advice how can we resolve it ?

 
Eric Smith 9Eric Smith 9
See if this component will work for you in your flow:
https://github.com/alexed1/LightningFlowComponents/tree/master/flow_screen_components/lookupFSC
sales force 504sales force 504
Thanks Eric,
I read the documentation for the component you mentioned about, and in that case we will have to explicitly mention the filter criteria.
My scenario is such that I have an existing look up field on a Object with some filter and would like to use the same field in the flow so that changes made in the filter will reflect in the flow as well. 
The <force:inputField > gives me that result but I'm unable to use it in the flow
Eric Smith 9Eric Smith 9
Can you explain a little more about your use case and exactly what you are trying to do?
sales force 504sales force 504
I have a field on a Lead object which  looks up to Account object with some filter criteria. I want to use the same field in the Visual Flow so that if going forward, the filter criteria is changed I just change it on the Lead object and it automatically reflects in the flow as well.
Eric Smith 9Eric Smith 9
Any parameter in the flow can be used as an 'Output' parameter and the value passed back can then be used elsewhere in the flow.

Would the Parent/Child parameters work for this in your Flow?  
.
sales force 504sales force 504
Can you please elaborate ?
Eric Smith 9Eric Smith 9
The value of the parameter, selectedValue, in the lookupFSC component gets set in the LightningLookupHelper.js controller and is available to the flow in whatever variable you assign to the Output parameter for selectedValue.
User-added image
User-added image
User-added image
sales force 504sales force 504
Yes the output variable can be used later in the flow, but not clear how it will help me to cope with the changed filter condition in the look up field on the Object
Eric Smith 9Eric Smith 9
Here's a simple Flow that uses a user-defined filter condition:

FLOW with Filter Lookup
User-added image

SCREEN
User-added image
Product LOOKUP Field
User-added image

DECISION
User-added image
RECORD LOOKUP
User-added image