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
ArrgHunterArrgHunter 

Updating a custom field with mater-detail relationship

Hi guys,

I need help to update a custom field. I have two custom objects A and B with mater details relationship and both have education progress field. Every time When a new record is added to object B , i want to insert objects B’s (education progress fields) value into Object A’s education progress field and it will concatenate values with comma. Object A have one-to-many relationship with Object B.


Please suggest best way to achieve this.

Thanks in advance.

Regards,

Sonali BhardwajSonali Bhardwaj
You can write a trigger on Object B, which will fetch all B's records belonging to its A. Then update A's field with all B's records value.

For example -
There are records B - b1, b2, b3, b4, b5
b1, b2, b3 has parent as a1 and rest as parent as a2

Now if you are updating b1, then fetch its parent, which is a1, then fetch all child records of a1 which are b1, b2, b3 and update a1's field with all chid records (b1, b2, b3) field value.
sushant sussushant sus
You can create workflow (cross object workflow) because of masterdetail relationship .
condition will be every time created (1 one )