0

I have a input in a Flow. I need pass this variable to Flow (this flow will do some calculations according to the value of that input). I have tried to pass the recordId, and it works, but not the value of the input, is it possible?

enter image description here

lwc.meta

<targets>
    <target>lightning__AppPage</target>
    <target>lightning__FlowScreen</target>
</targets>

<targetConfigs>
    <targetConfig targets="lightning__FlowScreen">
        <property name="CurrentStage" type="String" label="Current Stage"  description="Current Stage"/>
        <property name="Stages" type="Stages" label="Stages"  description="Stages"/>
    </targetConfig>
</targetConfigs>

LWC.js

@api CurrentStage;
@api Stages;

If I change the value of the input it does not change in the LWC How can I pass this value to the flow? When changing the value, does any function jump to capture it?

Thank you

3
  • I had read that post. In the detail you don't see an input like in my case. I have tried to pass the id of the record and it does reach the LWC, what does not arrive is the value of the input (initially it is empty and when it is modified it is not reported in the flow)
    – Rodolfo
    Oct 14, 2022 at 11:46
  • if you need to return values from LWC to the flow, try this: Pass a variable out of LWC and up to Screen flow dynamically
    – McCubo
    Oct 14, 2022 at 11:57
  • I dont use attribute role and neither the FlowAttributeChangeEvent function, are they necessary to send the flow to LWC? I think this is necessary to send from LWC to flow
    – Rodolfo
    Oct 14, 2022 at 13:20

1 Answer 1

0

It sounds like you want to use the output of one of your screen components as an input to another screen component, and have the second screen component react to changes in the first screen component.

Today, that's not possible. The Flow team is building a new reactive capability into screen components, which is previewed here. Salesforce hopes to make that available in beta form in Spring '23. With that implementation, you will not have to fire any events yourself. Any value you assign to an output-enabled attribute in your component will automatically be available to all of the inputs of all of the components on the screen, and will cause any components that consume that output to rerender.

If you absolutely need to solve this today, you could consider creating a wrapper component that wraps both of your components and mediates the event passing.

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