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
Jay reddyJay reddy 

Automatically setting the record type of a detail object based on the record type of its master object

For instance, we have "Custom Object A" and "Custom Object B" (Master-detail relationship). And Custom Object A has Record Type 'A' & 'B', Custom Object B has Record Types 'A1' & 'B1'. So, whenever I create a custom object 'A' record with record type 'A' and try to create a child object (Cus. Object B) through related list of Cus. Object A, it should automatically select record type 'A1' of Cus. object 'B' and same with record type 'B1' of cus. object B.

If (Custom Object A's record RT is A ---> Then Custom Object B's record RT should 'A1')
If (Custom Object A's record RT is B ---> Then Custom Object B's record RT should 'B1')

I've tried PB, WF, VR... but doesn't meet my requirement cuz i need the logic to be applied while creating the records of Cus. Object B, not after creating the record (needed to be in ligtning). There's coding solution for this requirement (below is the link) but it doesn't work if we click "Cancel" or "Save & New" button. I really appreciate if anyone could help.
https://force201.wordpress.com/2011/05/21/automatically-setting-the-record-type-of-a-detail-object-based-on-the-record-type-of-its-master-object/ 
 
Raj VakatiRaj Vakati
You can able to do it with simple workflow .. 

Create  a workflow On Custom Object B ... 


Rule Custom Object A__r.RecordType=='A' 


Field Update : Update the Record type to A 
Jay reddyJay reddy
@Raj V .... Thanks for your reply but as I've already explained that my requirement can't be done using workflows, as I want the record type to be set dynamically while I was creating the child record. 
Utsav Das 13Utsav Das 13
@Jay reddy, did you find a soluton to it?
Smadav AVSmadav AV
To protect your system from virus keep download this antivirus dude!!!
Avast 2020 (https://www.avastscan.com/avast-2020/), Kaspersky 2020 (https://www.antiviruspedia.net/kaspersky-2020/), Smadav 2020 (https://www.smadav2019.net/smadav-2020/), Smadav 2021 (https://www.smadav2021.net/smadav-2021/)