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
KMK91KMK91 

Get Parent record values

Hi,

how to get parent record values while creating child reocrd in Lwc component.

Thanks
KMK
AnkaiahAnkaiah (Salesforce Developers) 
Hi KMK,

Please refer the below trailhead to help you to proceed futher on this requirement.

https://trailhead.salesforce.com/en/content/learn/projects/communicate-between-lightning-web-components/communicate-from-child-to-parent

If this helps, please mark it as best answer.

Thanks!!
mukesh guptamukesh gupta
Hi KMK,

Please follow below url for get more understanding:-

https://medium.com/salesforce-champion/lwc-way-to-pass-the-data-between-component-parent-to-child-and-child-to-parent-component-6d8070ef4185 

if you need any assistanse, Please let me know!!

Kindly mark my solution as the best answer if it helps you.

Thanks
Mukesh 
Suraj Tripathi 47Suraj Tripathi 47
Hi KMK91, 

We can get parent record values in child records by calling the parent name from the child component like this 
 
<template>
 <c-child name={nameFromParent}></c-child>
</template>

for complete examples see below link
 
https://www.sfdckid.com/2020/08/api-property-lightning-web-component.html

If you find your Solution then mark this as the best answer. 

Thank you!

Regards 
Suraj Tripathi

 
Ken Koellner @ EngagewareKen Koellner @ Engageware

Is there a away to simple get the field value of a parentId and pass it to record ID?

A use case is I have a LWC it put on a Contact page layout.  I want it to show Account info.

Here's an generic example LWC line--

<lightning-record-edit-form record-id={recordId} object-api-name={objectApiName}>
Can I could something like --
<lightning-record-edit-form record-id={AccountId} object-api-name='Account'>


And use the component on a Contact Lighting Record Page?  

If the concept is sound but I have the syntax incorrect, can anyone clue me in as to the correct syntax.