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
Force.platformForce.platform 

how to fetch child record on parent record

I have Parent__C and child__C object with lookup rel.
there is one field on child__c ie. tracking_number__c.
i want this tracking number firld value on parent. how can i do?
Khan AnasKhan Anas (Salesforce Developers) 
Hi,

I trust you are doing very well.

To fetch child record in a parent, you can use below SOQL query.

Parent-Child SOQL:
[SELECT Id, (SELECT Id, Name, Tracking_Number__c FROM Childs__r) FROM Parent__c];

If you want to update parent record using child record you can use process builder or trigger. Please refer to below link to update parent record using child record using process builder.

https://developer.salesforce.com/forums/?id=9060G000000UVjrQAG

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in future.

Thanks and Regards,
Khan Anas
Force.platformForce.platform
Hi Anas,
                can i do this by formula field? i am not doing any trigger or apex code part here?
Satyendra Singh 15Satyendra Singh 15
sure, you can creat a formula field on parent
Khan AnasKhan Anas (Salesforce Developers) 
Hi,

You can achieve this without Apex by using Process Builder and Flows.

Please refer to the below links which might help you further with the above issue.

http://succeedwithsalesforce.com/using-process-and-flows-to-update-parent-record-based-on-all-related-child-records/

https://success.salesforce.com/answers?id=90630000000ZggwAAC

https://developer.salesforce.com/forums/?id=9060G000000UVjrQAG


I hope it helps you.

Kindly mark this as solved if the information was helpful.

Regards,
Khan Anas