1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Salesforce_Schema_SObjectType編

Posted at

SObjectType

Schema.sObjectType オブジェクトは、getReferenceTo メソッドを使用して Field Describe Result から、または getSObjectType メソッドを使用して sObject Describe Result から返されます。

名前空間

Schema

SObjectTypeを取得する日常コード


SObjectType token1 = Schema.opportunity.sObjectType;
System.debug('token1:'+token1);


Map tokenMap = System.Schema.getGlobalDescribe();
SObjectType token2 = tokenMap.get('opportunity');
System.debug('token2:'+token2);


Co_SaisankeisankihonRireki__c obj = new opportunity();
SObjectType token3_1 = obj.getSObjectType();
System.debug('token3_1:'+token3_1);


List objList = new List();
SObjectType token3_2 = objList.getSObjectType();
System.debug('token3_2:'+token3_2);


Id oppId = Id.valueOf('a1Z9D000000oArKUAU');【環境18桁SFDCID】
SObjectType token4 = oppId.getSObjectType();
System.debug('token4:'+token4);

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?