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
Melissa ParkerMelissa Parker 

Update record type of a related record based on the parent record type

Hello,

I understand there isn't a standard function in SF to update a child record type based on the parent object record type. Does anyone have any example I can use to do this with a trigger? What I would like to do is, if the parent record type is changed, then the child Task record type changes as well. Any help would be appriecated! Thanks.
Best Answer chosen by Melissa Parker
YuchenYuchen
You can write a after update trigger on that Object, then loop through trigger.new, if Trigger.oldMap.get(theid).get('RecordTypeid')!=Trigger.newMap.get(theid).get('RecordTypeid'), put it in some List. Then query the Object to get all the child objects associated with the object in the List you build previously. For these child objects, you can then update the record type.

All Answers

Sumitkumar_ShingaviSumitkumar_Shingavi
Write a trigger on parent object which updates RT on childs. Do a inner query to fetch chield objects in a single SOQL.
YuchenYuchen
You can write a after update trigger on that Object, then loop through trigger.new, if Trigger.oldMap.get(theid).get('RecordTypeid')!=Trigger.newMap.get(theid).get('RecordTypeid'), put it in some List. Then query the Object to get all the child objects associated with the object in the List you build previously. For these child objects, you can then update the record type.
This was selected as the best answer
Audrey Kadis 9Audrey Kadis 9
Can this be done with Process Builder?  I want to do this for a small nonprofit that I work with as a volunteer.  I'm not a developer and don't know how to write triggers or use SOQL.  I tried with Process Builder, but what I built doesn't work and I don't know if I made a mistake or I'm trying to do something that can't be done.
Any suggestions would be greatly appreciated.  Thank you in advance.
DevWannabeDevWannabe
Audrey Kadis 9, were you able to resolve this through process builder.  If not, let me know and I will try to help.