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
Firas Taamallah 18Firas Taamallah 18 

How to assign Case RecordType to picklist Value ?

Hi , 

I want the case record type to be changed automatically every time it's related object's field which is picklist change 

Example : 
  • Case A , Record Type  = B
  • Custom Object C , Picklist value = C
In this case , the case record type should be changed to C - How can i achieve this using Apex ? 
Id devRecordTypeId = Schema.SObjectType.Case.getRecordTypeInfosByName().get(era.EmailRule__r.CaseRecordType__c).getRecordTypeId();

This line seems doesn't work , i tried to get ID of the custom object's field ( picklist value ) and assign it to Case recordType  ..

Thanks,​​​​​​​
ShirishaShirisha (Salesforce Developers) 
Hi Firas,

Greetings!

You can achieve this by using process builder as suggested in this blog (https://automationchampion.com/tag/change-record-types-in-salesforce1/).

Kindly mark it as best answer if it helps so that it can help others in the future.

Warm Regards,
Shirisha Pathuri