Skip to main content
sandy hello (Capital info solutions) 님이 #Apex에 질문했습니다
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개
  1. 2021년 9월 6일 오전 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,

    ​​​​​​​