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
Vinh ChauVinh Chau 

How to update a specific field from a child record(related list) if there are multiple record items?

Hello All,

I'm new to salesforce and wondering how to update a field value in a related list if there more than one record in that list and you want to update only a specific record.

For example: In the below image, I would like to update the Payment received field with a value.
How would you update only one of the payment fields if there are more than one null value in the Payment received?

Would this have to be done with an trigger?

User-added image

Any help or suggestions would be apprieciated.

King regards,
Vinh
Best Answer chosen by Vinh Chau
Veenesh VikramVeenesh Vikram
Oh!

Im afraid but you will need an identifier on the record you want to Update. Thats the only solution my friend!

Veenesh

All Answers

Veenesh VikramVeenesh Vikram
Hi Vinh,

In order to update the child records from parent, you can uuse a Process Builder instead of a trigger.
Here you can update the child records and also put a condition to update particular child record based on any filter.

Let me know if you have doubts in this.
Kindly mark as best answer if this was of help.

Veenesh
Vinh ChauVinh Chau
Hello Vennesh,

Thank you for your reply, currently I am doing it with Process builder it works fine if there is only one blank value for Payment received, as it will then populute that value and I can check for null. The issue arises if there are multiple records with null values for  Payment received, it will populate all Payment received fields that are null. 

Kind Regards,
Vinh
Veenesh VikramVeenesh Vikram
Yes Vinh,

That is the expected behavior, You must have an identifier in place to identify which record(s) to update, if you are checking for null as a criteria before updating the record, the process builder will update all records that will meet this criteria.
We cannot limit to uppdate on only one record. we can only limit using a condition. So you will need to identify which single record to update by having a unique identifier.

How are you iuidentifieng which single record you want updated?

Veenesh
Vinh ChauVinh Chau
Hi Venesh, 

Yes it working as expected since it doesnt know what record to update. 

That's my issue not sure how to identify which single record I want to update. 

Kind regards, 
Vinh
Veenesh VikramVeenesh Vikram
Oh!

Im afraid but you will need an identifier on the record you want to Update. Thats the only solution my friend!

Veenesh
This was selected as the best answer