[Salesforce][ENG]Get object API reference name from object label

Here is an example of getting an object display label from an object API reference name.

    String searchObjLabelName = '取引先';
    Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
    for (String sKey : gd.keySet()) {
        Schema.DescribeSObjectResult targetObject = gd.get(sKey).getDescribe();
        if(targetObject.getLabel() == searchObjLabelName){
			System.debug('targetObject.getLabel()----->targetObject.getName()::::::'+targetObject.getLabel()+'----->'+targetObject.getName());
        }
    }

投稿者: kinkun

保有資格 Salesforce Certified Platform App Builder T Salesforce Certified Platform Developer I Salesforce Certified Platform Developer II Salesforce Certified Administrator

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です