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
sandy hellosandy hello 

How to retrieve recordtypename for a record in befor update event dynamically with out SOQL

I nee a recordtypename for record in before update event dynamically without SOQL, based on recordtype name i will proces the record further.How can i achieve this.
Hii Sandy
Try Below Code
Id devRecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Development').getRecordTypeId();


trigger recordTypeCheck on objectName (before insert) { 
     for(objectName obj :{ 
      if(obj.recordType.Name == 'RecordTypeAPI_Name' ) { 
         /*Your Code*/ 
Please Mark It As Best Answer If It Helps
Thank You!
AnkaiahAnkaiah (Salesforce Developers) 
Hi Sandy,

type with below code and modify according to your need.
trigger beforeupdateRecordtype on Account (before update) {
    for(Account acc:
        if(acc.recordtype.Name =='Customer Account'){
           // Proceed with fields you want to update 


If this helps, Please mark it as best answer.

Sai PraveenSai Praveen (Salesforce Developers) 
Hi Sandy,

You can use the below logic to get the record type name.
trigger AccountTrigerr on Account (before update) {

Map<ID, Schema.RecordTypeInfo> rtMap = Schema.SObjectType.Account.getRecordTypeInfosById();
        if(rtMap.get(acc.RecordTypeId).getName() =='merchant KYC Account'){

If this solution helps, Please mark it as best answer