Skip to main content
Jonathan Meltzer 님이 #Lightning Experience에 질문했습니다

Greetings!  I am creating a Lightning App Page where I am entering an account code into component A.  That code gets sent to component B via pub/sub, and component B sees it just fine.  I want component B to then make an Apex call to get records from another object (call it ACV) based on the account code that was sent from component A.  I have tried various combinations of @wire, @api, and @track, and have also tried to make the call in the event that is fired when the account code changes, but I cannot get the data from the ACV object to display in component B.  I know I am missing something basic, but I cannot find any examples of a component that subscribes to an event and then makes an Apex call to get records and display them.

Does anyone have an example of a pair of components that does this?  To recap:

Component A has an input field where the user enters an account code.  When the code changes, component A uses @wire to run Apex and get the Account record.  A fireEvent sends the new account record to component B, who is subscribed to it.

Component B runs a function when the event fires, and can display information related to the account record from Component A, but I want to run another Apex method to get ACV records associated with the account and display them in the HTML for component B.

I hope this explains what I want to do.  The APEX methods take a string parameter called searchTerm to do their searches, and return an array of records that should be size 1.

Thank you for any help.
답변 1개
  1. 2020년 4월 29일 오후 4:35
    I found a way to do this.  It seems that you can use @wire the way I wanted to do it, but my syntax was off a bit.  Not even sure what the error was.

     
0/9000