I created a simple Apex Trigger that shows an error message when user tries to create an event without adding any attendee. I created a custom label for error message and its translations in different languages. This works fine in all the languages except for one (Japanese). The record gets saved if the user's language is Japanese.

trigger Event_Attendee_Validation on Event (after insert, after update) {
    Id ManagerRecordTypeId = Schema.SObjectType.Event.getRecordTypeInfosByName().get('Manager').getRecordTypeId();
    System.Debug('Event_Attendee_Validation Get RT ==> ' + ManagerRecordTypeId ); 
        for(Event event: Trigger.New){
            if (event.IsChild == false && event.Type == 'Dual Day' && event.RecordTypeId == ManagerRecordTypeId) {
                List<Event> childevents = [SELECT id From Event Where Task_Reference__c =:event.Task_Reference__c AND RecordTypeId =:event.RecordTypeId];
                System.Debug('Event_Attendee_Validation Get Child Events ==> ' + childevents );           
                if (childevents.size() == 1){
    catch(Exception e){
        System.debug('Event_Attendee_Validation ==> Error found inside for loop');
  • 1
    @VinayJagwani The solution has been added below as an Answer, please take a moment to upvote and accept if you problem is solved. Also, please consider reversing your edit that removed the problem code. Having code available helps other users benefit from your question. Jul 28, 2022 at 14:58
  • I've rolled back the edit that removed the code from this question. Please don't make that type of change.
    – David Reed
    Jul 28, 2022 at 16:44

1 Answer 1


You should use getRecordTypeInfosByDeveloperName rather than getRecordTypeInfosByName. The latter would be affected by translations as well, but the DeveloperName does not change.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .