1

I have a LWC component that exposes a variable called testData in lightning__FlowScreen. The testData property is used in screen to display text.

<targetConfig targets="lightning__FlowScreen">
        <property name="testData " label="Title" type="String" description=""/>
</targetConfig

In my LWC component, I have getters and setters for testData property

_testData;
@api
get testData(){
return this._testData;
}
set testData(val){
this._testData = val;
}

I have also created a button which on click dispatches flowAttributeChangeEvent with value 'abc'

handleOnClick(event){
const attributeChangeEvent = new FlowAttributeChangeEvent('testData','abc');
this.dispatchEvent(attributeChangeEvent);
}

Now, In the flow screen, If I click Previous navigation button and next nav btn again then the testData value is empty. I thought the value would be 'abc' but it seems flow will assign the value returned by getter of testData ?

Do I have to assign 'abc' value to _testData variable ? Can't I directly pass data to flowAttributeChangeEvent ?

1 Answer 1

1

It is important you configure your variables in remember mode. This mode is entered if a Lightning Component has values mapped for both the input and the output of a particular field or is using Automatic Output Handling.

Make sure to uncheck the "Manually assign Variables (advanced)” checkbox.

<targetConfig targets="lightning__FlowScreen">
    <property name="testData " label="Title" type="String" role=“inputOnly” description=""/>
</targetConfig

You must log in to answer this question.

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