Conditionally changing the record type on Child Record based on Parent Record Type - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Manoj KumarManoj Kumar 

Conditionally changing the record type on Child Record based on Parent Record Type

I want to create a new record for a child object that has two record types - Record Type XX and Record Type ZZ
 
So, if the parent record has record type A, then my child record should have record Type XX otherwise Record Type ZZ.   I want my users to be able to bypass the record type selection.
 
I tried creating a custom button by following some answers on the community. It is working for the first criteria i.e. if it is TRUE but when it is FALSE it is asking for Record Type selection.
 
/006/e?retURL=%2F{!Account.Id}&accid={!Account.Id}&RecordType={!IF(TEXT(Account.Account_Type__c)='A','01290000000G80C','01290000000G802')}&ent=testobject__c
 
 
What am I doing wrong?
 
Any help appreciated!
 
 
Best Answer chosen by Manoj Kumar
Jeff MayJeff May
That is pretty easy.  The only time users are shown the 'record type selection' page is if they have more than 1 record type 'accessible' to them in their Profile or Permission Set.  Remember that 'accessible' means that users can create records of that record type. Record types do not control which records a user can see.

So, for your purposes, remove the record types from the 'accessible' types for your users Profiles and Permission Sets.  Then, use a Process Builder process to detect the creation of a new child record, and set its record type based on the conditions you want.

All Answers

Jeff MayJeff May
That is pretty easy.  The only time users are shown the 'record type selection' page is if they have more than 1 record type 'accessible' to them in their Profile or Permission Set.  Remember that 'accessible' means that users can create records of that record type. Record types do not control which records a user can see.

So, for your purposes, remove the record types from the 'accessible' types for your users Profiles and Permission Sets.  Then, use a Process Builder process to detect the creation of a new child record, and set its record type based on the conditions you want.
This was selected as the best answer
Manoj KumarManoj Kumar
Thanks, Jeff.. This works fine!!!
Amanda ElmoreAmanda Elmore
I'm trying to do this as well for accounts and contacts. The record type for a contact should equal the record type of the account since the account is the parent object. I've tried to setup what you've suggested but I can't figure it out. I was trying to setup one process to satisfy my 3 record types but maybe I need 3 separate processes?? 

I have 3 account record types, A, B, and C. If a contact is created from an account with an A record type then the contact should automatically be assigned AA record type and so on.
Account Record Type A = Contact Record Type AA
Account Record Type B = Contact Record Type BB
Account Record Type C = Contact Record Type CC

I’ve created the process for the Contact object for when a contact is created — ISNEW() — the record type should automatically be assigned by referencing the record type on the parent object, account. However, I’m not certain how to setup my criteria. I’m unable to reference fields from the account for the value - only reference fields from the contact object. 

User-added image
User-added image
User-added image

Am I going about this all wrong??

Thanks!