Topic

  • SalesforceXyToolsCoreを使ってDescribeMetadataを実行して、DescribeMetadataを実行してSalesforce組織を説明するメタデータを取得します。この情報には Apex クラスおよびトリガ、カスタムオブジェクト、標準オブジェクトのカスタム項目、アプリケーションを定義するタブセット、および他の多くのメタデータ型が含まれています。

DescribeMetadataの実行

  • Salesforce組織のユーザ名、パスワード、Apiバージョン、Product/Sandboxを設定してください。
from SalesforceXytoolsCore import *
import pprint

config = {
    "api_version": 42.0, 
    "username": "sfdc username", 
    "password": "sfdc password", 
    "security_token": "", 
    "is_sandbox": True
}

meta_api = MetadataApi(username=config["username"], 
                password=config["password"], 
                security_token=config["security_token"], 
                sandbox=config["is_sandbox"],
                version=config["api_version"]
                )

"""
describeMetadata :
    This call retrieves the metadata that describes your organization. 
    This information includes Apex classes and triggers, custom objects, custom fields on standard objects, tab sets that define an app, and many other metadata types.
"""
result = meta_api.describeMetadata()
pprint.pprint(result)
# print(json.dumps(result, indent=4))

結果確認

OrderedDict([('metadataObjects',
              [OrderedDict([('directoryName', 'installedPackages'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'installedPackage'),
                            ('xmlName', 'InstalledPackage')]),
               OrderedDict([('childXmlNames', 'CustomLabel'),
                            ('directoryName', 'labels'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'labels'),
                            ('xmlName', 'CustomLabels')]),
               OrderedDict([('directoryName', 'staticresources'),
                            ('inFolder', 'false'),
                            ('metaFile', 'true'),
                            ('suffix', 'resource'),
                            ('xmlName', 'StaticResource')]),
               OrderedDict([('directoryName', 'scontrols'),
                            ('inFolder', 'false'),
                            ('metaFile', 'true'),
                            ('suffix', 'scf'),
                            ('xmlName', 'Scontrol')]),
               OrderedDict([('directoryName', 'certs'),
                            ('inFolder', 'false'),
                            ('metaFile', 'true'),
                            ('suffix', 'crt'),
                            ('xmlName', 'Certificate')]),
               OrderedDict([('directoryName', 'aura'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('xmlName', 'AuraDefinitionBundle')]),
               OrderedDict([('directoryName', 'lightningcomponents'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('xmlName', 'LightningComponentBundle')]),
               OrderedDict([('directoryName', 'components'),
                            ('inFolder', 'false'),
                            ('metaFile', 'true'),
                            ('suffix', 'component'),
                            ('xmlName', 'ApexComponent')]),
               OrderedDict([('directoryName', 'pages'),
                            ('inFolder', 'false'),
                            ('metaFile', 'true'),
                            ('suffix', 'page'),
                            ('xmlName', 'ApexPage')]),
               OrderedDict([('directoryName', 'queues'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'queue'),
                            ('xmlName', 'Queue')]),
               OrderedDict([('directoryName', 'CaseSubjectParticles'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'CaseSubjectParticle'),
                            ('xmlName', 'CaseSubjectParticle')]),
               OrderedDict([('directoryName', 'dataSources'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'dataSource'),
                            ('xmlName', 'ExternalDataSource')]),
               OrderedDict([('directoryName', 'namedCredentials'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'namedCredential'),
                            ('xmlName', 'NamedCredential')]),
               OrderedDict([('directoryName', 'externalServiceRegistrations'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'externalServiceRegistration'),
                            ('xmlName', 'ExternalServiceRegistration')]),
               OrderedDict([('directoryName', 'roles'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'role'),
                            ('xmlName', 'Role')]),
               OrderedDict([('directoryName', 'groups'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'group'),
                            ('xmlName', 'Group')]),
               OrderedDict([('directoryName', 'globalValueSets'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'globalValueSet'),
                            ('xmlName', 'GlobalValueSet')]),
               OrderedDict([('directoryName', 'standardValueSets'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'standardValueSet'),
                            ('xmlName', 'StandardValueSet')]),
               OrderedDict([('directoryName', 'customPermissions'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'customPermission'),
                            ('xmlName', 'CustomPermission')]),
               OrderedDict([('childXmlNames',
                             ['CustomField',
                              'Index',
                              'BusinessProcess',
                              'CompactLayout',
                              'RecordType',
                              'WebLink',
                              'ValidationRule',
                              'SharingReason',
                              'ListView',
                              'FieldSet']),
                            ('directoryName', 'objects'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'object'),
                            ('xmlName', 'CustomObject')]),
               OrderedDict([('directoryName', 'reportTypes'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'reportType'),
                            ('xmlName', 'ReportType')]),
               OrderedDict([('directoryName', 'reports'),
                            ('inFolder', 'true'),
                            ('metaFile', 'false'),
                            ('suffix', 'report'),
                            ('xmlName', 'Report')]),
               OrderedDict([('directoryName', 'dashboards'),
                            ('inFolder', 'true'),
                            ('metaFile', 'false'),
                            ('suffix', 'dashboard'),
                            ('xmlName', 'Dashboard')]),
               OrderedDict([('directoryName', 'analyticSnapshots'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'snapshot'),
                            ('xmlName', 'AnalyticSnapshot')]),
               OrderedDict([('directoryName', 'feedFilters'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'feedFilter'),
                            ('xmlName', 'CustomFeedFilter')]),
               OrderedDict([('directoryName', 'layouts'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'layout'),
                            ('xmlName', 'Layout')]),
               OrderedDict([('directoryName', 'documents'),
                            ('inFolder', 'true'),
                            ('metaFile', 'true'),
                            ('xmlName', 'Document')]),
               OrderedDict([('directoryName', 'weblinks'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'weblink'),
                            ('xmlName', 'CustomPageWebLink')]),
               OrderedDict([('directoryName', 'letterhead'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'letter'),
                            ('xmlName', 'Letterhead')]),
               OrderedDict([('directoryName', 'email'),
                            ('inFolder', 'true'),
                            ('metaFile', 'true'),
                            ('suffix', 'email'),
                            ('xmlName', 'EmailTemplate')]),
               OrderedDict([('directoryName', 'quickActions'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'quickAction'),
                            ('xmlName', 'QuickAction')]),
               OrderedDict([('directoryName', 'flexipages'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'flexipage'),
                            ('xmlName', 'FlexiPage')]),
               OrderedDict([('directoryName', 'tabs'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'tab'),
                            ('xmlName', 'CustomTab')]),
               OrderedDict([('directoryName', 'customApplicationComponents'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'customApplicationComponent'),
                            ('xmlName', 'CustomApplicationComponent')]),
               OrderedDict([('directoryName', 'applications'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'app'),
                            ('xmlName', 'CustomApplication')]),
               OrderedDict([('directoryName', 'EmbeddedServiceConfig'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'EmbeddedServiceConfig'),
                            ('xmlName', 'EmbeddedServiceConfig')]),
               OrderedDict([('directoryName', 'EmbeddedServiceBranding'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'EmbeddedServiceBranding'),
                            ('xmlName', 'EmbeddedServiceBranding')]),
               OrderedDict([('directoryName', 'flows'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'flow'),
                            ('xmlName', 'Flow')]),
               OrderedDict([('directoryName', 'flowDefinitions'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'flowDefinition'),
                            ('xmlName', 'FlowDefinition')]),
               OrderedDict([('directoryName', 'eventSubscriptions'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'subscription'),
                            ('xmlName', 'EventSubscription')]),
               OrderedDict([('directoryName', 'eventDeliveries'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'delivery'),
                            ('xmlName', 'EventDelivery')]),
               OrderedDict([('childXmlNames',
                             ['WorkflowFieldUpdate',
                              'WorkflowKnowledgePublish',
                              'WorkflowTask',
                              'WorkflowAlert',
                              'WorkflowSend',
                              'WorkflowOutboundMessage',
                              'WorkflowRule']),
                            ('directoryName', 'workflows'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'workflow'),
                            ('xmlName', 'Workflow')]),
               OrderedDict([('childXmlNames', 'AssignmentRule'),
                            ('directoryName', 'assignmentRules'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'assignmentRules'),
                            ('xmlName', 'AssignmentRules')]),
               OrderedDict([('childXmlNames', 'AutoResponseRule'),
                            ('directoryName', 'autoResponseRules'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'autoResponseRules'),
                            ('xmlName', 'AutoResponseRules')]),
               OrderedDict([('childXmlNames', 'EscalationRule'),
                            ('directoryName', 'escalationRules'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'escalationRules'),
                            ('xmlName', 'EscalationRules')]),
               OrderedDict([('directoryName', 'postTemplates'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'postTemplate'),
                            ('xmlName', 'PostTemplate')]),
               OrderedDict([('directoryName', 'approvalProcesses'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'approvalProcess'),
                            ('xmlName', 'ApprovalProcess')]),
               OrderedDict([('directoryName', 'homePageComponents'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'homePageComponent'),
                            ('xmlName', 'HomePageComponent')]),
               OrderedDict([('directoryName', 'homePageLayouts'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'homePageLayout'),
                            ('xmlName', 'HomePageLayout')]),
               OrderedDict([('directoryName', 'objectTranslations'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'objectTranslation'),
                            ('xmlName', 'CustomObjectTranslation')]),
               OrderedDict([('directoryName', 'globalValueSetTranslations'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'globalValueSetTranslation'),
                            ('xmlName', 'GlobalValueSetTranslation')]),
               OrderedDict([('directoryName', 'standardValueSetTranslations'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'standardValueSetTranslation'),
                            ('xmlName', 'StandardValueSetTranslation')]),
               OrderedDict([('directoryName', 'classes'),
                            ('inFolder', 'false'),
                            ('metaFile', 'true'),
                            ('suffix', 'cls'),
                            ('xmlName', 'ApexClass')]),
               OrderedDict([('directoryName', 'triggers'),
                            ('inFolder', 'false'),
                            ('metaFile', 'true'),
                            ('suffix', 'trigger'),
                            ('xmlName', 'ApexTrigger')]),
               OrderedDict([('directoryName', 'testSuites'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'testSuite'),
                            ('xmlName', 'ApexTestSuite')]),
               OrderedDict([('directoryName', 'profiles'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'profile'),
                            ('xmlName', 'Profile')]),
               OrderedDict([('directoryName', 'permissionsets'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'permissionset'),
                            ('xmlName', 'PermissionSet')]),
               OrderedDict([('directoryName', 'customMetadata'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'md'),
                            ('xmlName', 'CustomMetadata')]),
               OrderedDict([('directoryName', 'profilePasswordPolicies'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'profilePasswordPolicy'),
                            ('xmlName', 'ProfilePasswordPolicy')]),
               OrderedDict([('directoryName', 'profileSessionSettings'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'profileSessionSetting'),
                            ('xmlName', 'ProfileSessionSetting')]),
               OrderedDict([('directoryName', 'datacategorygroups'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'datacategorygroup'),
                            ('xmlName', 'DataCategoryGroup')]),
               OrderedDict([('directoryName', 'remoteSiteSettings'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'remoteSite'),
                            ('xmlName', 'RemoteSiteSetting')]),
               OrderedDict([('directoryName', 'cspTrustedSites'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'cspTrustedSite'),
                            ('xmlName', 'CspTrustedSite')]),
               OrderedDict([('childXmlNames', 'MatchingRule'),
                            ('directoryName', 'matchingRules'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'matchingRule'),
                            ('xmlName', 'MatchingRules')]),
               OrderedDict([('directoryName', 'duplicateRules'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'duplicateRule'),
                            ('xmlName', 'DuplicateRule')]),
               OrderedDict([('directoryName', 'cleanDataServices'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'cleanDataService'),
                            ('xmlName', 'CleanDataService')]),
               OrderedDict([('directoryName', 'authproviders'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'authprovider'),
                            ('xmlName', 'AuthProvider')]),
               OrderedDict([('directoryName', 'eclair'),
                            ('inFolder', 'false'),
                            ('metaFile', 'true'),
                            ('suffix', 'geodata'),
                            ('xmlName', 'EclairGeoData')]),
               OrderedDict([('directoryName', 'sites'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'site'),
                            ('xmlName', 'CustomSite')]),
               OrderedDict([('directoryName', 'channelLayouts'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'channelLayout'),
                            ('xmlName', 'ChannelLayout')]),
               OrderedDict([('directoryName', 'contentassets'),
                            ('inFolder', 'false'),
                            ('metaFile', 'true'),
                            ('suffix', 'asset'),
                            ('xmlName', 'ContentAsset')]),
               OrderedDict([('childXmlNames',
                             ['SharingOwnerRule', 'SharingCriteriaRule']),
                            ('directoryName', 'sharingRules'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'sharingRules'),
                            ('xmlName', 'SharingRules')]),
               OrderedDict([('directoryName', 'sharingSets'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'sharingSet'),
                            ('xmlName', 'SharingSet')]),
               OrderedDict([('directoryName', 'communities'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'community'),
                            ('xmlName', 'Community')]),
               OrderedDict([('directoryName', 'ChatterExtensions'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'ChatterExtension'),
                            ('xmlName', 'ChatterExtension')]),
               OrderedDict([('directoryName', 'callCenters'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'callCenter'),
                            ('xmlName', 'CallCenter')]),
               OrderedDict([('directoryName', 'connectedApps'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'connectedApp'),
                            ('xmlName', 'ConnectedApp')]),
               OrderedDict([('directoryName', 'appMenus'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'appMenu'),
                            ('xmlName', 'AppMenu')]),
               OrderedDict([('directoryName', 'delegateGroups'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'delegateGroup'),
                            ('xmlName', 'DelegateGroup')]),
               OrderedDict([('directoryName', 'siteDotComSites'),
                            ('inFolder', 'false'),
                            ('metaFile', 'true'),
                            ('suffix', 'site'),
                            ('xmlName', 'SiteDotCom')]),
               OrderedDict([('directoryName', 'networkBranding'),
                            ('inFolder', 'false'),
                            ('metaFile', 'true'),
                            ('suffix', 'networkBranding'),
                            ('xmlName', 'NetworkBranding')]),
               OrderedDict([('directoryName', 'brandingSets'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'brandingSet'),
                            ('xmlName', 'BrandingSet')]),
               OrderedDict([('directoryName', 'flowCategories'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'flowCategory'),
                            ('xmlName', 'FlowCategory')]),
               OrderedDict([('directoryName', 'lightningBolts'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'lightningBolt'),
                            ('xmlName', 'LightningBolt')]),
               OrderedDict([('directoryName', 'lightningExperienceThemes'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'lightningExperienceTheme'),
                            ('xmlName', 'LightningExperienceTheme')]),
               OrderedDict([('directoryName', 'samlssoconfigs'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'samlssoconfig'),
                            ('xmlName', 'SamlSsoConfig')]),
               OrderedDict([('directoryName', 'corsWhitelistOrigins'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'corsWhitelistOrigin'),
                            ('xmlName', 'CorsWhitelistOrigin')]),
               OrderedDict([('directoryName', 'actionLinkGroupTemplates'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'actionLinkGroupTemplate'),
                            ('xmlName', 'ActionLinkGroupTemplate')]),
               OrderedDict([('directoryName', 'transactionSecurityPolicies'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'transactionSecurityPolicy'),
                            ('xmlName', 'TransactionSecurityPolicy')]),
               OrderedDict([('directoryName', 'synonymDictionaries'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'synonymDictionary'),
                            ('xmlName', 'SynonymDictionary')]),
               OrderedDict([('directoryName', 'pathAssistants'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'pathAssistant'),
                            ('xmlName', 'PathAssistant')]),
               OrderedDict([('directoryName', 'LeadConvertSettings'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'LeadConvertSetting'),
                            ('xmlName', 'LeadConvertSettings')]),
               OrderedDict([('directoryName', 'cachePartitions'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'cachePartition'),
                            ('xmlName', 'PlatformCachePartition')]),
               OrderedDict([('directoryName', 'topicsForObjects'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'topicsForObjects'),
                            ('xmlName', 'TopicsForObjects')]),
               OrderedDict([('directoryName', 'emailservices'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'xml'),
                            ('xmlName', 'EmailServicesFunction')]),
               OrderedDict([('directoryName', 'settings'),
                            ('inFolder', 'false'),
                            ('metaFile', 'false'),
                            ('suffix', 'settings'),
                            ('xmlName', 'Settings')])]),
             ('organizationNamespace', None),
             ('partialSaveAllowed', 'true'),
             ('testRequired', 'false')])