I'm trying to build a form of "journey" through lightning components in the new Flow designer but I'm having a hard time making the flow play. Basically, I've got component 1
that let's the user select an account - selecting an account triggers an application event and another component listens for that event to render Assets that belongs to the account in component 2
. This works fine If I just put the different components on a Lightning Page. However, I wish to embed each component in a Flow
, and have each component on a separate screen. E.g screen #1 shows component 1
, -> user selects an account and clicks Next
and component 2
on screen #2 displays the assets that belongs to component 1
on screen #1.
I did include the recordId in a design attribute and I can see the recordId being clicked when I go to screen #2, but for some reason, component 2
does not receive the event since it sits on a different screen.
Here's the event for component 1
onRowAction: function( component, event, helper ) {
var action = event.getParam( 'action' );
var row = event.getParam( 'row' );
if (action.name == 'check_record') {
component.set("v.recordId", row.Id)
var event = $A.get("e.c:AccountSelected")
event.setParams({
accoId: row.Id
});
}
event.fire();
}
And then the handler that listens to the event in component 2
:
<aura:handler event="c:AccountSelected" action="{!c.queryAssets}" />
queryAssets: function(component, event, helper) {
let accountId = event.getParam('accoId');
helper.callServer(component, "c.getResources", function(response) {
component.set("v.assetList", response);
}, {accId: accountId});
},
Why is component 2
not receiving anything when the event is fired in component 1