Skip to main content
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.
3 respuestas
  1. 6 sept 2021, 10:23
    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();

    for(Account acc:Trigger.new){

    if(rtMap.get(acc.RecordTypeId).getName() =='merchant KYC Account'){

    acc.Rating='Hot';

    }

    }

    }

    If this solution helps, Please mark it as best answer

    Thanks,

    ​​​​​​​
0/9000