2

In answering the following question, I noticed that most of the fields being queried were system/audit fields: Display sObject fields on Visualforce. That made me wonder if we could guarantee these fields exist.

According to the SOAP API Developer Guide, most objects have these fields defined:

  • System Fields
    • Id
    • IsDeleted
  • Audit Fields
    • CreatedById
    • CreatedDate
    • LastModifiedById
    • LastModifiedDate
    • SystemModstamp

What is most in this case? Which objects do not have these fields defined?

1 Answer 1

6

Approach

I ran this script to find the standard objects missing each field:

for (SObjectType sObjectType : Schema.getGlobalDescribe().values())
{
    DescribeSObjectResult describe = sObjectType.getDescribe();
    if (!describe.isCustom() && !describe.fields.getMap().containsKey('Id'))
        system.debug(sObjectType);
}

System Fields

Id

Only one standard object is missing the Id field: AssetTokenEvent.

IsDeleted

133 standard objects are missing the IsDeleted field:

AggregateResult                 ApexClass                       ApexComponent                  
ApexLog                         ApexPage                        ApexPageInfo                   
ApexTestQueueItem               ApexTestResult                  ApexTrigger                    
AssetTokenEvent                 AssignmentRule                  AsyncApexJob                   
AuraDefinitionBundleInfo        AuraDefinitionInfo              AuthSession                    
BrandTemplate                   BusinessHours                   BusinessProcess                
CallCenter                      CaseStatus                      CaseTeamMember                 
CaseTeamRole                    CaseTeamTemplate                CaseTeamTemplateMember         
CaseTeamTemplateRecord          CategoryNode                    ChatterActivity                
ClientBrowser                   CollaborationGroup              CollaborationGroupMember       
CollaborationGroupMemberRequest CollaborationInvitation         Community                      
ConnectedApplication            ContentWorkspace                ContractStatus                 
CronJobDetail                   CronTrigger                     CustomBrand                    
CustomBrandAsset                CustomObjectUserLicenseMetrics  DashboardComponent             
DataStatistics                  DataType                        DatacloudAddress               
DocumentAttachmentMap           Domain                          DomainSite                     
EmailServicesAddress            EmailServicesFunction           EmailStatus                    
EmailTemplate                   EmbeddedServiceDetail           EntitlementTemplate            
EntityDefinition                EntityParticle                  FeedTrackedChange              
FieldDefinition                 FieldPermissions                FiscalYearSettings             
FlexQueueItem                   Folder                          ForecastShare                  
Group                           GroupMember                     Holiday                        
KnowledgeableUser               LeadStatus                      ListView                       
ListViewChartInstance           LoginHistory                    LoginIp                        
MilestoneType                   Name                            Network                        
NetworkMember                   NetworkMemberGroup              NetworkModeration              
OauthToken                      ObjectPermissions               OpportunityStage               
OrgWideEmailAddress             Organization                    OwnerChangeOptionInfo          
PackageLicense                  PartnerRole                     Period                         
PermissionSet                   PermissionSetAssignment         PicklistValueInfo              
PlatformAction                  ProcessDefinition               ProcessInstanceStep            
ProcessNode                     ProductEntitlementTemplate      Profile                        
Publisher                       QuantityForecast                QuantityForecastHistory        
QueueSobject                    RecentlyViewed                  RecordType                     
RelationshipDomain              RelationshipInfo                RevenueForecast                
RevenueForecastHistory          Scontrol                        SearchLayout                   
SelfServiceUser                 SetupAuditTrail                 SetupEntityAccess              
Site                            SolutionStatus                  StaticResource                 
TaskPriority                    TaskStatus                      ThirdPartyAccountLink          
Topic                           TwoFactorMethodsInfo            User                           
UserAccountTeamMember           UserAppMenuItem                 UserEntityAccess               
UserFieldAccess                 UserLicense                     UserLogin                      
UserPackageLicense              UserPreference                  UserRecordAccess               
UserRole                        UserShare                       UserTeamMember 
WebLink

Audit Fields

There are 29 standard objects missing all audit fields. These objects are not listed again below:

AggregateResult                 ApexPageInfo                    AuraDefinitionBundleInfo       
ContentFolderLink               CronJobDetail                   DashboardComponent             
DataStatistics                  DataType                        DatacloudAddress               
EmbeddedServiceDetail           EntityParticle                  FeedAttachment                 
FeedTrackedChange               FlexQueueItem                   ListViewChartInstance          
LoginHistory                    Name                            OwnerChangeOptionInfo          
PicklistValueInfo               Publisher                       RecentlyViewed                 
RelationshipDomain              RelationshipInfo                ThirdPartyAccountLink          
TwoFactorMethodsInfo            UserAppMenuItem                 UserEntityAccess 
UserFieldAccess                 UserRecordAccess

The remaining objects are missing a subset of audit fields.

Created

There are 70 standard objects missing both CreatedById and CreatedDate (including those listed above). The remaining 41 are:

AccountShare                    ApexLog                         ApexTestResult                 
AuraDefinitionInfo              CampaignShare                   CaseShare                      
ChatterActivity                 ContactShare                    ContentDocumentLink            
CustomObjectUserLicenseMetrics  EntityDefinition                FieldDefinition                
FieldPermissions                FiscalYearSettings              FlowInterviewShare             
ForecastShare                   GroupMember                     KnowledgeableUser              
LeadShare                       LiveAgentSessionShare           LiveChatTranscriptShare        
MacroShare                      OpportunityShare                Period                         
PermissionSetAssignment         PlatformAction                  ProcessNode                    
QuickTextShare                  SearchLayout                    ServiceContractShare           
SetupEntityAccess               SocialPostShare                 StreamingChannelShare          
TodayGoalShare                  UserAppMenuCustomizationShare   UserLicense                    
UserLogin                       UserPreference                  UserProvisioningRequestShare 
UserRole                        UserShare

CreatedById

There are 76 standard objects missing the CreatedById field (including those listed above). The 6 objects missing this field which have the CreatedDate field defined are:

AuthSession                     ClientBrowser                   ContentWorkspaceDoc            
LoginIp                         OauthToken                      PackageLicense 

CreatedDate

There are 71 objects missing the CreatedDate field (including those listed above). The only standard object missing this field which has CreatedById defined is QueueSobject.

Last Modified

There are 99 standard objects missing both LastModifiedById and LastModifiedDate (including those listed above). The remaining 70 are:

AccountHistory                  ApexTestQueueItem               ApexTestResult                 
AssetHistory                    AssetTokenEvent                 AsyncApexJob                   
CaseArticle                     CaseHistory                     CaseSolution                   
CaseTeamTemplateRecord          ChatterActivity                 ClientBrowser                  
ContactHistory                  ContentDistributionView         ContentDocumentHistory         
ContentDocumentLink             ContentVersionHistory           ContentWorkspaceDoc            
ContractHistory                 ContractLineItemHistory         CustomObjectUserLicenseMetrics 
DocumentAttachmentMap           EmailMessageRelation            EntitlementHistory             
EntitySubscription              FeedComment                     FeedLike                       
FeedPollChoice                  FeedRevision                    FieldPermissions               
FiscalYearSettings              GroupMember                     IdeaComment                    
KnowledgeableUser               LeadHistory                     LinkedArticleHistory           
LiveAgentSessionHistory         LiveChatTranscriptHistory       LoginIp                        
MacroHistory                    NetworkMember                   NetworkModeration              
OauthToken                      OpportunityFieldHistory         OpportunityHistory             
Period                          PermissionSetAssignment         Pricebook2History              
ProcessInstanceHistory          ProcessInstanceStep             ProcessInstanceWorkitem        
ProcessNode                     Product2History                 ProductEntitlementTemplate     
QuantityForecastHistory         QuestionDataCategorySelection   QueueSobject                   
QuickTextHistory                RevenueForecastHistory          ServiceContractHistory         
SetupAuditTrail                 SetupEntityAccess               SiteHistory                    
SocialPersonaHistory            SocialPostHistory               SolutionHistory                
Topic                           TopicAssignment                 UserLicense 
UserPreference

LastModifiedById

There are 130 objects missing the LastModifiedById field (including those listed above). Of those, 31 objects do have the LastModifiedDate field defined:

AccountFeed                     ApexLog                         AssetFeed                      
AuraDefinitionInfo              AuthSession                     CampaignFeed                   
CaseFeed                        CollaborationGroupFeed          ContactFeed                    
ContentDocumentFeed             ContractFeed                    DashboardComponentFeed         
DashboardFeed                   EntitlementFeed                 EventFeed                      
FeedItem                        FeedPollVote                    LeadFeed                       
LinkedArticleFeed               OpportunityFeed                 PackageLicense                 
PlatformAction                  Product2Feed                    ReportFeed                     
ServiceContractFeed             SiteFeed                        SocialPostFeed                 
SolutionFeed                    TaskFeed                        TopicFeed  
UserFeed

LastModifiedDate

There are 100 objects missing the LastModifiedDate field (including those listed above). The only standard object missing this field which has the LastModifiedById field defined is CronTrigger.

SystemModStamp

There are 97 standard objects which do not have the SystemModStamp field defined (including those listed above). The remaining 68 are:

AccountHistory                  AccountShare                    AssetHistory                   
AssetTokenEvent                 AsyncApexJob                    AttachedContentDocument        
AuraDefinitionInfo              AuthSession                     CampaignShare                  
CaseHistory                     CaseShare                       ClientBrowser                  
CombinedAttachment              ContactHistory                  ContactShare                   
ContentDocumentHistory          ContentVersionHistory           ContractHistory                
ContractLineItemHistory         CronTrigger                     CustomBrand                    
CustomBrandAsset                DocumentAttachmentMap           EmailStatus                    
EntitlementHistory              EntityDefinition                EntitySubscription             
FeedLike                        FeedPollChoice                  FeedPollVote                   
FieldDefinition                 FlowInterviewShare              ForecastShare                  
LeadHistory                     LeadShare                       LinkedArticleHistory           
LiveAgentSessionHistory         LiveAgentSessionShare           LiveChatTranscriptHistory      
LiveChatTranscriptShare         LoginIp                         MacroHistory                   
MacroShare                      NetworkModeration               OauthToken                     
OpportunityFieldHistory         OpportunityShare                OwnedContentDocument           
PlatformAction                  Pricebook2History               Product2History                
QuickTextHistory                QuickTextShare                  SearchLayout                   
ServiceContractHistory          ServiceContractShare            SetupAuditTrail                
SiteHistory                     SocialPersonaHistory            SocialPostHistory              
SocialPostShare                 SolutionHistory                 StreamingChannelShare          
TodayGoalShare                  UserAppMenuCustomizationShare   UserLogin 
UserProvisioningRequestShare    UserShare

You must log in to answer this question.

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