0

I have component and need to use here user input from flow screen. So i have a text field with api name 'Request' and want to use input from that field in my custom component, that replaces default footer.I already have custom component but no clue about getting user input.

Component:

<aura:component access="global" implements="lightning:availableForFlowScreens">
        
   <aura:attribute name="canPause" type="Boolean" />
   <aura:attribute name="canBack" type="Boolean" />
   <aura:attribute name="canNext" type="Boolean" />
   <aura:attribute name="canFinish" type="Boolean" />
    <aura:attribute name="availableActions" type="String[]" />
    <aura:registerEvent name="navigateFlowEvent" type="c:navigateFlow"/>
   <aura:handler name="init" value="{!this}" action="{!c.init}" />
        
   <div aura:id="actionButtonBar" class="slds-clearfix slds-p-top_medium">
      <div class="slds-float_left">
         <aura:if isTrue="{!v.canBack}">
            <lightning:button aura:id="BACK" label="Previous"
               variant="neutral" onclick="{!c.onButtonPressed}" />
         </aura:if>
      </div>
      <div class="slds-float_right">
         <!-- If Pause, Next, or Finish are available, display to the right -->
         <aura:if isTrue="{!v.canPause}">
            <lightning:button aura:id="PAUSE" label="Pause"
               variant="neutral" onclick="{!c.onButtonPressed}" />
         </aura:if>
         <aura:if isTrue="{!v.canNext}">
            <lightning:button aura:id="NEXT" label="Next" 
               variant="brand" onclick="{!c.onButtonPressed}" />
         </aura:if>
         <aura:if isTrue="{!v.canFinish}">
            <lightning:button aura:id="FINISH" label="Done"
               variant="brand" onclick="{!c.onButtonPressed}" />
         </aura:if>
      </div>
   </div>
</aura:component>
2
  • Welcome to Salesforce Stack Exchange (SFSE). It is unclear to me what exactly you are asking: How to create a Flow to get user input? How to use the user input from an already existing Flow? Something else?
    – Moonpie
    Sep 22, 2021 at 15:26
  • @Moonpie i have flow with text field where user must write something and that data i want to use in my custom footer component.
    – Terdivi
    Sep 22, 2021 at 15:29

1 Answer 1

0

So there are two ways to integrate visual flows with lightning components. One is to have the lightning component be the main screen, with a flow launched from inside of it. The other is to have the flow be the main screen, with the lightning component launched inside of it. Given that you're using lightning:availableForFlowScreens, I assume your situation is the latter -- a flow that contains a lightning component.

I've never done it myself, but according to the docs, passing information into a lightning component can be done in three steps:

  1. Add an attribute to the lightning component that contains a variable that you want to get/set from/to the flow.
  2. In the lightning component's design file, add the attribute again. This exposes the attribute as something that configuration screens can configure.
  3. In the flow, add the component. The screen should display any attributes listed in the design file.

Docs have sample code to give an idea of what to add.

5
  • Well, thanks. It works but i passing input value it doenst updated on user writing and still nothing. Is it possible to change it via js in controller? Cause its different from default input.
    – Terdivi
    Sep 22, 2021 at 16:55
  • Basically I think you need to track down where the value is failing to update. I would put a change handler on the attribute in the lightning component, and in the JS controller, write a console.log statement that outputs the value every time it's changed. If that never logs in the console, or at least never logs when it changes, then you know that the flow is failing to update the lightning component. If that's the case, it may just be a limitation of flows, that they only populate the value of the lightning component attribute one time, when the screen loads. Then you'd research alternatives Sep 22, 2021 at 17:29
  • Got it, thank you. I will try it tomorrow and then will accept answer.
    – Terdivi
    Sep 22, 2021 at 17:34
  • So i tried many ways and it doesnt work, zero reaction onchange.
    – Terdivi
    Sep 23, 2021 at 7:57
  • Sounds like this piece of my comment applies then: "If that's the case, it may just be a limitation of flows, that they only populate the value of the lightning component attribute one time, when the screen loads. Then you'd research alternatives" Others in the community might have some alternatives you can work with, or better knowledge of how lightning components in flows interact. Sep 23, 2021 at 18:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .