Wednesday, December 11, 2013

List of the Salesforce Object Key Prefixes


Key PrefixObject Type
000Empty Key
001Account
002Note
003Contact
005User
006Opportunity
007Activity
008OpportunityHistory
00BListView / View
00DOrganization
00EUserRole
00GGroup
00IPartner
Also OpportunityPartner, which "is automatically created when a Partner object is created for a partner relationship between an account and an opportunity"
00JOpportunityCompetitor
00KOpportunityContactRole
00NCustomFieldDefinition - Setup > Create > Objects > [Your Object] > [Your Field]
CF00NCustom Field Id using in the query string. Note the keyprefix isn't actually CF0. In this case "CF" has been appended to the "00N" of the Custom Field Definition.
00OReport
00PAttachment
00QLead
00SImportQueue
00TTask
00UEvent
00XEmailTemplate
00YEmailTemp
00aCaseComment or IdeaComment
Use caution as there are at least two object types exposed via the partner API with the same keyPrefix!
00aIdeaComment or CaseComment
Use caution as there are at least two object types exposed via the partner API with the same keyPrefix!
00bWebLink - Custom Button or Link
00cTraining
00eProfile
00hLayout - Page Layout
00iPricebook
00jProduct
00kOpportunityLineItem
00lFolder
00oOpportunityLineItemSchedule
Represents information about the quantity, revenue distribution, and delivery dates for a particular OpportunityLineItem.
Products, Price Books, and Schedules Overview
00pUserTeamMember
00qOpportunityTeamMember - "This object is available only in organizations that have enabled team selling."
00rAccountShare
00sAccountOwnerSharingRule
00tOpportunityShare
00uOpportunityOwnerSharingRule
00vCampaignMember
010CaseSolution
011GroupMember
012RecordType
013RecordTypePicklist
014ProfileRecordType
015Document
016BrandTemplate (Letterhead)
018EmailStatus
019BusinessProcess
01ABusinessProcessPicklist
01BLayoutSection
01CLayoutItem
01DUserAccountTeamMember
01GProfileLayout
01HMailmergeTemplate
01ICustom Object
01JPicklistMaster
01NScontrol
01PProfileTabConfiguration
01QWorkflowRule - AssignmentRule
01RRuleFilter
01SRuleFilterItem
01TRuleFilterAction
01UActionAssignEscalate
01VActionTask
01WActionEmail
01XActionEmailRecipient
01YCampaignMemberStatus
01ZDashboard
01aDashboardComponent
01bListViewCriterion
01cListViewDisplayColumn
01ePicklistSet
01hTranslation
01jLocalizedValue
01kFieldPermissions
01lActionResponse
01mBusinessHours
01nCaseShare
01oLeadShare
01pApexClass
01qApexTrigger
01rCustomTabDefinition - Visualforce Tab
01sPricebook2
01tProduct2
01uPricebookEntry
01vPricebookShare
01wOpportunityUpdateReminder
01yCaseOwnerSharingRule
01zCaseEscalation
020EventAttendee
022FiscalYearSettings
023Calendar
024CalendarShare
025ListLayoutItem
026Period
02ALeadOwnerSharingRule
02BLabelDefinition
02CLabelData
02DCaseHistory2
02FCustomFieldMap
02TCustomPage
02UCustomPageItem
02VPageComponent
02XCustomPageProfile
02YUserComponentData
02ZAccountContactRole
02aContractContactRole
02bComponentResourceLink
02cSharing Rule
02fDelegateGroup
02gDelegateGroupMember
02hDelegateGroupGrant
02iAsset
02kListLayout
02mCustomIndex
02nCategoryNode
02oCategoryData
02pDivTransferEvent
02qLayoutItemColumn
02rOpportunityAlert
02tEmailRoutingAddress
02uTabSet
02vTabSetMember
02wLoginIpRange
02xLoginHours
02yReportAggregate
02zReportColorRange
033AllPackage - Package being built in the developer org
034PackageMember
035SelfServiceUser
036JobQueue
037ReportColumn
038ReportFilterItem
039ReportBreak
03DContactOwnerSharingRule
03GAccountCriteriaSharingRule
03HContactCriteriaSharingRule
03ICaseCriteriaSharingRule
03JChatterMessage
03KChatterMessageThread
03MChatterConversation
03NChatterConversationMember
03aDependentPicklist
03cLayoutRightPanel
03dValidationFormula - Validation Rule
03eCustomSetupDefinition
03fCustomSetup
03gQueueSobject
03iConsoleConfig
03jCaseContactRole
03kConsoleConfigItem
03nApexClassIdentifier
03qApexClassIdentifierRelationship
03sContactShare
03uUserPreference
040ReportParam
043OutboundField
044ExternalizedReference
045PartnerNetworkSetup
04YActionFieldUpdate - Field Update
04ZEntityLock
04aProcessDefinition
04bProcessNode
04cProcessTransition
04dProcessTransitionCondition
04eProcessActionItem
04fProcessWorkitemProperties
04gProcessInstance
04hProcessInstanceStep
04iProcessInstanceWorkitem
04jProcessAllowedSubmitter
04kActionOutboundMessage - Outbound Message Id
04lOutboundMessage - Outbound Notification Id
04mAdditionalNumber
04nSoftphoneLayout
04oSoftphoneLayoutSection
04pSoftphoneLayoutItem
04qSoftphoneLayoutInfoField
04rSoftphoneLayoutCallType
04sAsyncRequest - AsyncResultDeployResult
04tAllPackageVersion - Install Package
04uActionOverride
04vCallCenter
04xPackageExtension
04zLayoutItemActionRef
050PackageLicense
051UserPackageLicense
052SfdcOutboundMessage
053WorkflowTimeTrigger
054WorkflowTimeAction
055WorkflowTimeQueue
056ContentTagName
057ContentDocumentSubscription
058ContentWorkspace
059ContentWorkspaceDoc
05AContentWorkspaceMembership
05BCampaignCriteriaSharingRule
05CContentVersionComment
05GIpWhitelist
05ICampaignSharingRuleFilterItem
05JContentVersionRating
05KContentVersionRenditionContent
05LDBCThumbnailFilter
05NContentVersionTagName
05PContentWorkspacePermission
05QContentTagSubscription
05RContentWorkspaceSubscription
05SContentUserSubscription
05TContentContent
05UEntityFeedLayout
05VContentNotification
05WContentNotificationParam
05XDocumentAttachmentMap
05ZContentWorkspaceRecentEvent
05tCustomEntityTranslation
060Portal
061PortalAccount
062PortalStyleConfig
063MobileConfig
064QuerySet
065QuerySetItem
066ApexPage
067PortalMember
068ContentVersion
069ContentDocument
06AContentDocumentLink
06BContentWorkspaceAllowedRecType
06GCustomConsoleComponent
06NApplicationDependency
06OServiceDeskAttributes
06PApplication - Connected App
070CustomReportType
071CrtObject
072CrtColumn - Related to reports in some way.
073CrtLayoutSection
076RateLimitingNotification
078ApiUsage
079MobileMarkedRecord
07AMassMail
07DFeedPostTemplate
07ESandbox
07FFeedFavorite
07GSummaryRecalcQueue
07JComponentObjectDependency
07KComponentFeatureDependency
07LApexLog
07MApexTestResult
07OCanvas
07PEntitySizeJob
07RDataCategoryMapping
07TAuthConfig
07UAuthConfigProviders
07VActionSend
07YBatchOrgSizeJob
07ZEntityDataSize
07eFeedPostTemplateItem
07nApexExecutionOverlayResult
080PacCrudPermission
081StaticResource
082UninstallExport - Data from Uninstalled Packages? A zip containing CSVs.
083Vote
084VoteConfig
085VoteStats
086MobileDevice
087Idea
08EAddressCountry
08FAddressState
08aCronJobDetail
08dCampaignOwnerSharingRule
08eCronTrigger
08gCronFiredTrigger
08sCampaignShare
090MobileExcludedField
091EmailServicesFunction
092Weekly Data Export
093EmailServicesAddress
094MobileView
095MobileViewSortColumn
096MobileViewDisplayColumn
097MobileViewFilter
099ApexComponent
09AFeedPollChoice
09BFeedPollVote
09DQuickActionDefinition
09FDatacloudPurchaseUsage
09HConnectedApplication2
09IQuickActionListItem
09JQuickActionList
09SAsyncRequestFFX
09TAsyncRequestFFXResult
09UDomainCookieStore
09VDashboardStickyFilter
09aCommunity
0A0ReportJob
0A1ReportJobFieldMap
0A2DevelopmentPackageVersion - Change Set
0A3InstalledPackageVersion - Installed Package
0A4ProcessTransitionApprover
0A5AllManagedPackageMember
0A7CustomShareRowCause
0A8ReportJobRun
0A9ReportJobRunError
0ABProfilePortalDelegate
0ADPackageEvent
0AHCompactLayout
0AIFirehoseCheckpoint
0ALExternalSocialAccount
0AMCompactLayoutItem
0ANCompactLayoutMapping
0ATEventLogFile
0AUAuthSecurityLevel
0AWCanvasFeedItem
0AXConsolePersonalization
0AZActionApex
0AfDeployRequest
0AiDeployMessage
0AjAsyncApiTransformationSpec
0AkAuthSession
0AlDeployTestResult
0B0MobileEntitySetting
0B1MessageIdentifier
0B2PortalLanguageConfig
0B3PortalLanguageTabConfig
0B9MobileTab
0BACustomDataType
0BBCustomDataTypeComponent
0BCCustomFieldDataColumn
0BEFileFieldData
0BFComponentAppVersion
0BGCampaignInfluenceAdjustment
0BHAllManagedClassRelationship
0BIContentVersionMap
0BJActionAssignTeam
0BLPackageIdMapping
0BMConnection - Salesforce to Salesforce
0BRLogSearchResult
0BVOpportunityCriteriaSharingRule
0BWMobilePushDevice
0BXHistoricalEntityConfig
0BYMqSlaRequest
0BZEmailBrand
0BaLoginBrandAsset
0BbLoginBrand
0BcMqSlaJob
0BdHistoricalFieldConfig
0BeHistoricalTransactionPrefix
0BfHistoricalStaging
0BiHistoricalSelectorValue
0BkHistoricalSelector
0BlBlacklistedConsumer
0C0Holiday
0C2MobileSession
0C8LongJob
0CCSiteChangelistComponent
0CFChatterNowUserFavorites
0CIEntityImplements
0CJFieldImplements
0CLSiteChangelist
0CSChatterNowUserSettings
0CiAppManifest
0D1DataCategoryGroup
0D2OrgWideEmailAddress
0D3OrgEmailAddressSecurity
0D4LeadCriteriaSharingRule
0D5FeedItem or NewsFeed or UserProfileFeed
Use caution as there are at least three object types exposed via the partner API with the same keyPrefix!
0D6FeedTrackedChange
0D7FeedComment
0D8AllManagedMemberOption
0D9LeadSharingRuleFilterItem
0DAEntityCategoryGroup
0DCProcessTransitionAction
0DDSynonymGroup
0DESynonym
0DFVersionSet
0DGNamedFilter
0DHFieldAttributes
0DMSite
0DNSitePageOverride
0DRAndroidPushApplicationSetup
0DSAppMenuItem
0DTIdeaReputationLevel
0DULimitUsageHistory
0DVPushUpgradeRequest
0DXPushUpgradeJob
0DYPushUpgradeJobError
0DbForecastingType
0DfInstanceSizeJob
0E0EmailSyncConfig
0E1EmailSyncEntitySetting
0E2EmailSyncFieldMapping
0E3EmailSyncValueMapping
0E4EmailConfigEntitySetting
0E5EmailUserEntitySetting
0E6EmailSyncAdvancedSetting
0E8EntitySubscription
0EAPackageVersionPatchOrg
0EBRenderer
0EGReportChart
0EHSummaryLayout
0EISummaryLayoutItem
0EJSummaryLayoutSliceInfo
0EMContentReference - Appears next to refid query string parameter when pulling images. See rtaimage servlet parameters…what does the refid refer to?
0EOPicklistItemProperty
0EPInbound Change Set?
0EQCategoryJobTask
0ERRichTextAreaFieldData
0EVAllInstalledPackageVersion
0EbModuleDependency
0EeHistoricalDataFilter
0EfHistoricalDataFilterItem
0EgGlobalDbKey
0F0EmailTempAttachmentMap
0F3ReportBlock
0F5PhotoItem
0F7FeedPost
0F8SoftphoneScreenPopOption
0F9CollaborationGroup
0FACsnDomain
0FBCollaborationGroupMember
0FGMobilePushServiceDevice
0FHLinkReference
0FMFeedMapping
0FOOrgSizeJob
0FPReportRunTracker
0FQTrialMaster
0FRPackageOperationError
0FTTopicAssignment
0FaContextFieldAttributes
0G1FeedFieldHistory
0G8ReportBucketField
0G9AccountSharingRuleFilterItem
0GCEmailDisclaimer
0GDReportBucketFieldValue
0GEReportBucketFieldSourceValue
0GHSchemaBuilderLayout
0GISchemaBuilderLayoutItem
0GJApplePushApplicationSetup
0H0SiteRedirectMapping
0H1CollaborationInvitation
0H4ConnectedApplication
0H7PackageSupportAccess
0HFPublishEvent
0HGEntitySharingModel
0HIReportBlockAggregate
0HNTwoFactorInfo
0HOMobilePushSetupRegistry
0HRMetricsTransmissionHistory
0HiAppIpRange
0HjAppManifestVersion
0HkConnectivityDevConfig
0HlConnectivityAttributes
0I0FeedLike
0I2SiteAsset
0I3SiteComponent
0I4Domain
0I5CollaborationGroupMemberRequest
0I6OpportunitySharingRuleFilterItem
0I7CaseSharingRuleFilterItem
0I8ContactSharingRuleFilterItem
0I9ReportObjectFilterItem
0IAKnowledgeLanguageConfig
0IBDashboardFilter
0ICDashboardFilterItem
0IDDashboardFilterRepCol
0IFPushTopic
0IIFeedCrossReference
0IOBrandingValue
0ISApexComponentAttribute
0IVLogSearch
0IXFieldSet
0IYFieldSetItem
0IhServiceDeskComponent
0IiPushProfileMapping
0IjPushIntent
0IkModule
0InPhoenixDataSync
0IoRawEmail
0J0SetupEntityAccess
0J2Personalization
0J4SPSamlAttributes
0J5PredictiveModel
0J8ServiceDeskHotkey
0JSJigsawSavedSearch
0JfDomainSite
0K0ActionKnowledgeSubmit
0K2ActionChatterPost
0K3ActionChatterPostRecipient
0LDRecalcCampaignStats
0LGReportInstance
0LNStorageSizeJob
0M1SocialUserAuth
0MESessionLevelPolicy
0MFSynonymDictionary
0MJSystemStreamingChannel
0O0XinstanceInfo
0P0FlowVariableAssignment
0P1Certificate
0P2CertificateIp
0PFParallelJobItemData
0PLPermissionSetLicense
0PQProcessTimeQueue
0PSPermissionSet - Permission set metadata
0PaPermissionSetAssignment
0Q0Quote
0QcActionQuickCreate
0RAActivityRelation
0REEventRelation
0RTTaskRelation
0SOAuthProvider
0TITopicIndex
0TOTopic
0TYTopicOntology
0TtTopicTerm
0XCExternalDataSource
0XUExternalDataUserAuth
0YaLoginHistory
0YmSetupAuditTrail
0YsParallelJobStatus
0YuIdpEventLog
0YwUserLogin
0caChatterActivity
0csOauthConsumerScope
0e1ProfileClientSettings
0ebEntityBlacklist
0hcHashtagCount
0hdHashtagDefinition
0htHashtag
0inInfluence
0nsProcessNodeSecurity
0rpRemoteProxy
0spServiceProvider
0tRTopicRecordSetting
0tSTopicSuggestionSetting
0teTopicUserEvent
0tgTopicGroupActivity
0trTrendingTopic
0tsProcessTransitionSecurity
0tuTopicUserActivity
100UserLicense
101ExternalString - Custom Label
102FeatureLicense
10yTaskRecurrenceException
10zEventRecurrenceException
110ObjectPermissions
111EventComments
112ProposedEventTime
113ProposedEventResponse
11aDBCThumbnail
1ciIntegration
1clChangeList
1dcMetadataContainer - from the Tooling AP
1deIDEWorkspace
1doApexExecutionOverlayAction
1dpIDEPerspective
1drContainerAsyncRequest - from the Tooling API
204SfdcPartner
2LAPermissionSetLicenseAssign
300InteractionDefinition
301InteractionDefinitionVersion
308InteractionCondition
309InteractionOperand
30AInteractionAllocator
30CInteractionChoice
30DInteractionDecision
30FInteractionForm
30LInteractionConnector
30QInteractionQuestion
30RInteractionReference
30SInteractionStatement
30VInteractionVariable
30aInteractionAllocation
30cInteractionConstant
30dInteractionDataColumn
30fInteractionFormula
30gInteractionLayoutGroup
30mInteractionApexCall
30rInteractionResource
30tInteractionTodo
30vInteractionValueList
310InteractionLayoutDetail
31ASubinteraction
31CSubinteractionVariableAssignment
31SInteractionSwitch
31VInteractionFieldValue
31cInteractionChoiceLookup
31dInteractionDataSource
31iInteractionDataInput
31oInteractionDataOutput
31vInteractionValueListEntry
3M1OrgObjectsMetrics
3M3ChatterMetrics
3M4ChatterOrgWideMetrics
3M5NetworkCustomerLoginMetrics
3M6NetworkPartnerLoginMetrics
3MAPermissionSetMetricsByOrg
3MCOpportunityMetrics
3MDContentMetrics
3MFSharingRowCauseMetrics
3MGSharingMetrics
3MHIdeaMetrics
3MIUserDimMetrics
3MJPermissionSetLicenseMetrics
400ApexClassMember
401ApexTriggerMember
402ApexPageMember
403ApexComponentMember
4A0MetadataCheckout
4F0ApexClassVersion
4F1ApexTriggerVersion
4F2ApexPageVersion
4F3ApexComponentVersion
500Case
501Solution
5SpSegmentSpace
608ForecastShare
6AAAssociationQueueItem
6ABEventAssociationItem
6ACMailAssociationItem
6ADTaskAssociationItem
701Campaign
707AsyncApexJob
708BatchApexRelationship
709ApexTestQueueItem
710LoginIp
711ApiLoginKey
712LoginIpEmail
713ClientBrowser
714ApexCodeCoverage
715ApexCodeCoverageAggregate
716ApexOrgWideCoverage
729Photo
737FieldHistory
750AsyncApiJob - Bulk Query Job
751AsyncApiBatch - Bulk Query Batch
752AsyncApiQueryResult - Bulk Query Result
753TempStore
754AsyncApiJobOptions
766UiStyleDefinition
777UiStyle
7tfTraceFlag
800Contract
806Approval
80DOrganizationValue
888OauthConsumer - Remote Access

System.Exception: SObject row does not allow errors

Scenario:
 Error: System.Exception: SObject row does not allow errors
  
   This Exception is thrown when your adding an error message to particular record in a list which is looping through For Loop and that list gets records from the Trigger.oldMap context variable in Trigger.You can you use the addError method for only those records that are available in Trigger Context. 

Trigger Example:

 trigger BeforeDeleteConatct on Contact (Before Delete)
{
 Set<Id> conSet=Trigger.OldMap.keyset();
 List<Contact> listCon=[select id,phone from contact where id in:conset];

 for(Contact c:listCon)
 {
  if(c.Phone!=null)
  {
    System.debug('.......c......'+c);
    c.addError('you cant delete this contact because  it conatins Phone Number');
   }
  }
}

When you click on delete button of a particular contact it throws below error

Validation Errors While Saving Record(s)
There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Apex trigger BeforeDeleteConatct caused an unexpected exception, contact your administrator: BeforeDeleteConatct: execution of BeforeDelete caused by: System.FinalException: SObject row does not allow errors: Trigger.BeforeDeleteConatct: line 11, column 1". 
Work Around to Resolve This Error:

 trigger BeforeDeleteConatct on Contact (Before Delete)
{
 Set<Id> conSet=Trigger.OldMap.keyset();
 List<Contact> listCon=[select id,phone from contact where id in:conset];

 for(Contact c:listCon)
 {
  if(c.Phone!=null)
  {
    System.debug('.......c......'+c);
    Add below line of code to resolve Error
    Contact actualRecord = Trigger.oldMap.get(c.Id);
    actualRecord.addError('you cant delete this contact bcz it conatins Phone Number');
   }
  }
}

Validation Errors While Saving Record(s)
There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "you can't delete this contact because it conatins Phone Number".

Test Class for Before Trigger in Salesforce

Test Class:

    In the previous post I have posted one Before Trigger .For that Trigger the test class is given Below.

Test Class Code:

  @IsTest
private class Account_Trigger_Test 
{
	private static testMethod void testDelete()
	{
           Account acc=new Account(Name='Test Account;);
           insert acc;
 
           // should succeed
           delete acc;
        }

	private static testMethod void testDeleteFail()
	{
           Account acc=new Account(Name='Test Account',
                                   Client_ID__c='Should fail');
           insert acc;
 
           try
           {
              delete acc;
              // should throw an exception - the following assertion will cause an error if the code carries on
              System.assert(false);
           }
           catch (DMLException e)
           {
               // expected - could assert the message here
           }
        }
}

Before Delete Trigger in Salesforce

Scenario:
    
Write a Trigger on Account Object, All it does is to prevents the Delete of an Account if a particular field(i.e.,Client_ID__c) is not Null.

Trigger Code:


trigger AccountTrigger on Account (before delete) 
{ 
   if(System.Trigger.IsDelete)
   { 
     for (Account acc : trigger.old)
  {
    if (String.isNotBlank(acc.Client_ID__c))
     { 
  acc.addError('You cannot delete This Account Please contact your Salesforce.com Administrator for assistance.');
     }
         } 
   }
 }

Notes:

Trigger.oldReturns a list of the old versions of the sObject records.Note that this sObject list is only available in update and delete triggers.
Trigger.isDeleteReturns true if this trigger was fired due to a delete operation, from the Salesforce user interface, Apex, or the API.

For more information/samples on trigger please check out here



Please comment or write us if you have any queries/requirements.

Please follow,bookmark,subscribe this site to receive daily updates.

Facebook - https://www.facebook.com/ILoveCodingYou/?ref=bookmarks


Hope this helps you..Enjoy..!