function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
harish 1996harish 1996 

how we can get list of opportunities in parent component by selecting the opportunity stage feild in the child component

Best Answer chosen by harish 1996
H 007H 007
Hi, 
In Salesforce, one way to pass data from a child component to a parent component is by using custom events.
First, create a custom event in the child component that will be triggered when the opportunity stage field is selected.
In the parent component, create an event listener that listens for the custom event and retrieves the data passed with it.
In the child component, when the opportunity stage field is selected, fire the custom event and pass the list of opportunities as an argument.
In the parent component, the event listener will receive the list of opportunities and can then update the parent component's state or perform any other desired actions.
It's also possible to use props or other solution to pass data between components .

All Answers

H 007H 007
Hi, 
In Salesforce, one way to pass data from a child component to a parent component is by using custom events.
First, create a custom event in the child component that will be triggered when the opportunity stage field is selected.
In the parent component, create an event listener that listens for the custom event and retrieves the data passed with it.
In the child component, when the opportunity stage field is selected, fire the custom event and pass the list of opportunities as an argument.
In the parent component, the event listener will receive the list of opportunities and can then update the parent component's state or perform any other desired actions.
It's also possible to use props or other solution to pass data between components .
This was selected as the best answer
harish 1996harish 1996
hello bro could you please share the codes please