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
Phuc Nguyen 18Phuc Nguyen 18 

send parent attribute to child component

I have a 2 component.  I want to send the attribute value from the parent to child.  The attribute value is update after a record is created(I am pulling the record id back to the component).  But the attribute value shows undefined when use the second componen so that tells me that the attribute value is not getting updated.
I am referencing the second compont like this
<c:childcmp pcmpId="{!v.parentid}"/>

The child comp needs the parent id so whatever is the best way to get the parent id to the child component please advise.  I have tried events and have been not been succesful.
Thanks,
P
Best Answer chosen by Phuc Nguyen 18
vijay kumar kvijay kumar k
Hi phuc Nguyen

After record is created in parent component. You should set parentid attribute value with newly created record ID.
For set record you can simply use component.set('v.parentid',recordid);
You replace record ID with correct variable in above line.

Regards
Vijay

All Answers

vijay kumar kvijay kumar k
Hi phuc Nguyen

After record is created in parent component. You should set parentid attribute value with newly created record ID.
For set record you can simply use component.set('v.parentid',recordid);
You replace record ID with correct variable in above line.

Regards
Vijay
This was selected as the best answer
locat marklocat mark
As such, an NBI clearance is an important document to have when you apply for a job, start a business, or if you want to work or study abroad. The NBI clearance contains your name, address, place of birth, date of birth, date of issuance, and purpose for requesting it.
nbi-clearance (http://nbi-clearance.site/)