Successfully reported this slideshow.

The tooling Api demystified, It is not only for developers, Doria Hamelryk & Fabrice Challier

0

Share

1 of 32
1 of 32

The tooling Api demystified, It is not only for developers, Doria Hamelryk & Fabrice Challier

0

Share

Download to read offline

Description

We all know that moment when you are running a Salesforce project for a couple of months (or even years), and we need to do a configuration review.
Which field is not used anywhere, which permission set is assigned to which user, do we have duplicates in our custom labels…

Tricky right?

What if you had the opportunity to retrieve all this info with just a query.

And be sure, Admins will use it even more than developers

Transcript

  1. 1. The tooling Api demystified, it is not only for developers! by Doria Hamelryk & Fabrice Challier
  2. 2. #CD22 Who are we? Fabrice CHALLIER Doria HAMELRYK Managing Director @Little Chaman Salesforce Technical Lead Salesforce Trainer @ISDI (dex450,dex602) Toulouse, France User Group Community Group Leader Managing Director @GetMarcel Salesforce Architect - 15x certified - MVP Paris, France Women in Tech Community Group Leader Organisation Team member of : 🇲🇦 North Africa Dreamin’ (Casablanca) 🇫🇷 French Touch Dreamin’ (Paris)
  3. 3. #CD22 ● Present the Tooling Api ● Explain how it can be used by Admins ● Show Use Cases and Ready-to-use scripts Objectives of this session
  4. 4. #CD22 Definition APIs are a set of functions and procedures that allow an application to query or modify data from another application without accessing it directly. Request Response What is an API? (Application Programming Interface)
  5. 5. #CD22 Different API for different usage ● Depending on which element you want to work on : ● Many API’s are available for each type of element Tooling API Metadata API Rest API Soap API Bulk API Streaming API Metadata Data Event API’s in the Salesforce World
  6. 6. #CD22 If it’s config or dev, then it’s Metadata! (and if it’s related to records, then it’s not…) What are Metadata?
  7. 7. #CD22 Metadata API Tooling API (since Spring ‘2013) available in SOAP only available in REST, SOAP and SOQL Retrieve results in nodes Retrieve results in list Used for configuration migration Used for platform for debugging, code coverage,… Results - Shared info (with Metadata API): Results - Additional info: Select CreatedById, CreatedBy.Name, CreatedDate, fullname, Id, LastModifiedById, LastModifiedBy.Name, LastModifiedDate, ManageableState, Description, ErrorDisplayField, ErrorMessage, ValidationName, Active from ValidationRule where EntityDefinition.DeveloperName ='Case' and Id='03d3z000000QlbjAAC' Tooling API Query : Difference between Metadata API & Tooling API
  8. 8. #CD22 Tooling API Why and how to use it
  9. 9. #CD22 Useful for developers ● Search Metadata in SOQL ● Enabling debug mode & Debugging ● Test execution and code coverage analysis ● Class structure analysis ● Configuration modification ● Package generation ● Many more… Tooling API Usage Useful for admins ● Naming convention ● Object & Fields description ● Sharing Model analysis ● Wording of Validation Rules ● Layout not assigned ● Object Limits monitoring ● Many more…
  10. 10. #CD22 Workbench Developer Console Tooling API : query Tools
  11. 11. #CD22 Inspector (chrome extension) Admin Booster (https://www.adminbooster.com/) Tooling API : query Tools
  12. 12. #CD22 Tooling API Use Cases & Script Samples: SOQL
  13. 13. #CD22 select Id,CreatedBy.Name, CreatedDate, LastModifiedBy.Name, LastModifiedDate, DeveloperName, EntityDefinition.DeveloperName, Description from CustomField “I want to see ALL custom fields created and check if they all have a description.” Use Case : Custom Fields
  14. 14. #CD22 The EntityDefinition : key for everything select DeveloperName from CustomField where… Standard Field? Then use the ID directly with the Object API …EntityDefinitionId ='Case’ Custom Field? Then use the QualifiedApiName with the Object API …EntityDefinition.QualifiedApiName = ‘MyObject__c’ OR DeveloperName without ‘__c’ …EntityDefinition.DeveloperName = ‘MyObject’
  15. 15. #CD22 select DurableId,DeveloperName,description,InternalSharingModel,ExternalSharingModel,Qualifi edApiName from EntityDefinition where PublisherId ='<local>' and qualifiedapiname like '%__c' “I want to see ALL my custom objects and check best practices related to their name, description and sharing models” Use Case : Custom objects definition & sharing
  16. 16. #CD22 select DurableId,DeveloperName, issearchable, IsReportingEnabled, IsFieldHistoryTracked from EntityDefinition where PublisherId ='<local>' and qualifiedapiname like '%__c' “I want to see on which custom object I can perform searches, reporting and history tracking” Use Case : Custom objects search & reporting
  17. 17. #CD22 Select Id, EntityDefinition.DeveloperName, Active, ValidationName, ErrorDisplayField, ErrorMessage, Description from ValidationRule “I want to see all validation rules, check if they are active or not and if error messages are homogeneous (wording)” Use Case : Validation rules definition
  18. 18. #CD22 Select Id, EntityDefinition.DeveloperName, Active,ValidationName, ErrorDisplayField, ErrorMessage, Description from ValidationRule where ErrorMessage like '%date%' “I want to retrieve the validation rules having a specific Error Message” Use Case : Validation rules messages
  19. 19. #CD22 select Id, Name, TableEnumOrId from Layout where Id not in (select LayoutId from ProfileLayout) and layoutType ='Standard' “I want to list all layout that are not assigned to any profile” Use Case : Layout assignment
  20. 20. #CD22 select MasterLabel, ProcessType, RunInMode, Status, Description from Flow where Status != 'Obsolete' “I want to clean up my Automation (and kill Process Builders!)” Use Case : Automation analysis
  21. 21. #CD22 select Type, Label, Remaining, Max, EntityDefinitionid from EntityLimit where EntityDefinitionid='Account' “I want to monitor my object limit” Use Case : Limits monitoring ⚠️ Requires EntityDefinitionId or DurableId filter
  22. 22. #CD22 select MetadataComponentId, MetadataComponentName, MetadataComponentType, RefMetadataComponentId, RefMetadataComponentName,RefMetadataComponentType from MetadataComponentDependency where MetadataComponentType = 'Layout' and RefMetadataComponentType='CustomField' “I want to know which custom field is never displayed on layouts” Use Case : Unused Fields (Step 1 on 3) Layout ID Field ID Layout Name Field API
  23. 23. #CD22 select id, developername, EntityDefinition.QualifiedApiName from customfield “I want to know which custom field is never displayed on layouts” Use Case : Unused Fields (Step 2 on 3) Field ID Object API Field API
  24. 24. #CD22 =VLOOKUP(A2;Depend!D:D;1;0) =VLOOKUP(CELL_WITH_ID_FROM_FIELDS_LIST;TAB_WITH_DEPENDENCIES_LIST!COLUMN_WITH_RefMetadataComponentId;1;0) “I want to know which custom field is never displayed on layouts” Use Case : Unused Fields (Step 3 on 3) One tab with dependencies list One tab with fields list One Vlookup formula
  25. 25. #CD22 Be careful with MetadataComponentDependency Never forget Salesforce limits :) ● You can only retrieve 2k records with your query ● If you have > 2k records, results will be truncated, and not necessary to 2k records :) ● You don’t have any warning !
  26. 26. #CD22 select ApiVersion, Category, DeveloperName, IsReleased, ReleaseLabel, SupportsRevoke, StepStage, Title, Description from ReleaseUpdate where IsReleased=false “I want to monitor all release updates and check actions that need to be performed” Use Case : Release updates
  27. 27. #CD22 select CreatedBy.Name, CreatedDate, Description, EndDate, LicenseType, SandboxInfoId, SandboxName, source.SandboxName, Status, SystemModstamp from SandboxProcess “I want to list all my sandboxes and their history (creation, refresh, delete)” Use Case : Sandbox monitoring
  28. 28. #CD22 Tooling API Conclusion
  29. 29. #CD22 29 ● Tooling API is a powerful tool to retrieve Config and Dev information ● It can be used by anyone having basic knowledge of SOQL ● It’s possible to automate Health Check with the Tooling API ● All capabilities are documented on https://developer.salesforce.com/docs/atlas.en- us.234.0.api_tooling.meta/api_tooling/reference_objects_list.htm Tooling API: Summary
  30. 30. #CD22 30 To go further Ask help to your developer buddies if you don’t know how to build your query. Who knows, he/she could also learn something new :) Do not hesitate to contact us if you have any question : Doria Hamelryk : doria.hamelryk@gmail.com Fabrice Challier : fabricechallier@gmail.com This presentation and all the queries are available here : bit.ly/cztooling
  31. 31. #CD22 Thank You

Description

We all know that moment when you are running a Salesforce project for a couple of months (or even years), and we need to do a configuration review.
Which field is not used anywhere, which permission set is assigned to which user, do we have duplicates in our custom labels…

Tricky right?

What if you had the opportunity to retrieve all this info with just a query.

And be sure, Admins will use it even more than developers

Transcript

  1. 1. The tooling Api demystified, it is not only for developers! by Doria Hamelryk & Fabrice Challier
  2. 2. #CD22 Who are we? Fabrice CHALLIER Doria HAMELRYK Managing Director @Little Chaman Salesforce Technical Lead Salesforce Trainer @ISDI (dex450,dex602) Toulouse, France User Group Community Group Leader Managing Director @GetMarcel Salesforce Architect - 15x certified - MVP Paris, France Women in Tech Community Group Leader Organisation Team member of : 🇲🇦 North Africa Dreamin’ (Casablanca) 🇫🇷 French Touch Dreamin’ (Paris)
  3. 3. #CD22 ● Present the Tooling Api ● Explain how it can be used by Admins ● Show Use Cases and Ready-to-use scripts Objectives of this session
  4. 4. #CD22 Definition APIs are a set of functions and procedures that allow an application to query or modify data from another application without accessing it directly. Request Response What is an API? (Application Programming Interface)
  5. 5. #CD22 Different API for different usage ● Depending on which element you want to work on : ● Many API’s are available for each type of element Tooling API Metadata API Rest API Soap API Bulk API Streaming API Metadata Data Event API’s in the Salesforce World
  6. 6. #CD22 If it’s config or dev, then it’s Metadata! (and if it’s related to records, then it’s not…) What are Metadata?
  7. 7. #CD22 Metadata API Tooling API (since Spring ‘2013) available in SOAP only available in REST, SOAP and SOQL Retrieve results in nodes Retrieve results in list Used for configuration migration Used for platform for debugging, code coverage,… Results - Shared info (with Metadata API): Results - Additional info: Select CreatedById, CreatedBy.Name, CreatedDate, fullname, Id, LastModifiedById, LastModifiedBy.Name, LastModifiedDate, ManageableState, Description, ErrorDisplayField, ErrorMessage, ValidationName, Active from ValidationRule where EntityDefinition.DeveloperName ='Case' and Id='03d3z000000QlbjAAC' Tooling API Query : Difference between Metadata API & Tooling API
  8. 8. #CD22 Tooling API Why and how to use it
  9. 9. #CD22 Useful for developers ● Search Metadata in SOQL ● Enabling debug mode & Debugging ● Test execution and code coverage analysis ● Class structure analysis ● Configuration modification ● Package generation ● Many more… Tooling API Usage Useful for admins ● Naming convention ● Object & Fields description ● Sharing Model analysis ● Wording of Validation Rules ● Layout not assigned ● Object Limits monitoring ● Many more…
  10. 10. #CD22 Workbench Developer Console Tooling API : query Tools
  11. 11. #CD22 Inspector (chrome extension) Admin Booster (https://www.adminbooster.com/) Tooling API : query Tools
  12. 12. #CD22 Tooling API Use Cases & Script Samples: SOQL
  13. 13. #CD22 select Id,CreatedBy.Name, CreatedDate, LastModifiedBy.Name, LastModifiedDate, DeveloperName, EntityDefinition.DeveloperName, Description from CustomField “I want to see ALL custom fields created and check if they all have a description.” Use Case : Custom Fields
  14. 14. #CD22 The EntityDefinition : key for everything select DeveloperName from CustomField where… Standard Field? Then use the ID directly with the Object API …EntityDefinitionId ='Case’ Custom Field? Then use the QualifiedApiName with the Object API …EntityDefinition.QualifiedApiName = ‘MyObject__c’ OR DeveloperName without ‘__c’ …EntityDefinition.DeveloperName = ‘MyObject’
  15. 15. #CD22 select DurableId,DeveloperName,description,InternalSharingModel,ExternalSharingModel,Qualifi edApiName from EntityDefinition where PublisherId ='<local>' and qualifiedapiname like '%__c' “I want to see ALL my custom objects and check best practices related to their name, description and sharing models” Use Case : Custom objects definition & sharing
  16. 16. #CD22 select DurableId,DeveloperName, issearchable, IsReportingEnabled, IsFieldHistoryTracked from EntityDefinition where PublisherId ='<local>' and qualifiedapiname like '%__c' “I want to see on which custom object I can perform searches, reporting and history tracking” Use Case : Custom objects search & reporting
  17. 17. #CD22 Select Id, EntityDefinition.DeveloperName, Active, ValidationName, ErrorDisplayField, ErrorMessage, Description from ValidationRule “I want to see all validation rules, check if they are active or not and if error messages are homogeneous (wording)” Use Case : Validation rules definition
  18. 18. #CD22 Select Id, EntityDefinition.DeveloperName, Active,ValidationName, ErrorDisplayField, ErrorMessage, Description from ValidationRule where ErrorMessage like '%date%' “I want to retrieve the validation rules having a specific Error Message” Use Case : Validation rules messages
  19. 19. #CD22 select Id, Name, TableEnumOrId from Layout where Id not in (select LayoutId from ProfileLayout) and layoutType ='Standard' “I want to list all layout that are not assigned to any profile” Use Case : Layout assignment
  20. 20. #CD22 select MasterLabel, ProcessType, RunInMode, Status, Description from Flow where Status != 'Obsolete' “I want to clean up my Automation (and kill Process Builders!)” Use Case : Automation analysis
  21. 21. #CD22 select Type, Label, Remaining, Max, EntityDefinitionid from EntityLimit where EntityDefinitionid='Account' “I want to monitor my object limit” Use Case : Limits monitoring ⚠️ Requires EntityDefinitionId or DurableId filter
  22. 22. #CD22 select MetadataComponentId, MetadataComponentName, MetadataComponentType, RefMetadataComponentId, RefMetadataComponentName,RefMetadataComponentType from MetadataComponentDependency where MetadataComponentType = 'Layout' and RefMetadataComponentType='CustomField' “I want to know which custom field is never displayed on layouts” Use Case : Unused Fields (Step 1 on 3) Layout ID Field ID Layout Name Field API
  23. 23. #CD22 select id, developername, EntityDefinition.QualifiedApiName from customfield “I want to know which custom field is never displayed on layouts” Use Case : Unused Fields (Step 2 on 3) Field ID Object API Field API
  24. 24. #CD22 =VLOOKUP(A2;Depend!D:D;1;0) =VLOOKUP(CELL_WITH_ID_FROM_FIELDS_LIST;TAB_WITH_DEPENDENCIES_LIST!COLUMN_WITH_RefMetadataComponentId;1;0) “I want to know which custom field is never displayed on layouts” Use Case : Unused Fields (Step 3 on 3) One tab with dependencies list One tab with fields list One Vlookup formula
  25. 25. #CD22 Be careful with MetadataComponentDependency Never forget Salesforce limits :) ● You can only retrieve 2k records with your query ● If you have > 2k records, results will be truncated, and not necessary to 2k records :) ● You don’t have any warning !
  26. 26. #CD22 select ApiVersion, Category, DeveloperName, IsReleased, ReleaseLabel, SupportsRevoke, StepStage, Title, Description from ReleaseUpdate where IsReleased=false “I want to monitor all release updates and check actions that need to be performed” Use Case : Release updates
  27. 27. #CD22 select CreatedBy.Name, CreatedDate, Description, EndDate, LicenseType, SandboxInfoId, SandboxName, source.SandboxName, Status, SystemModstamp from SandboxProcess “I want to list all my sandboxes and their history (creation, refresh, delete)” Use Case : Sandbox monitoring
  28. 28. #CD22 Tooling API Conclusion
  29. 29. #CD22 29 ● Tooling API is a powerful tool to retrieve Config and Dev information ● It can be used by anyone having basic knowledge of SOQL ● It’s possible to automate Health Check with the Tooling API ● All capabilities are documented on https://developer.salesforce.com/docs/atlas.en- us.234.0.api_tooling.meta/api_tooling/reference_objects_list.htm Tooling API: Summary
  30. 30. #CD22 30 To go further Ask help to your developer buddies if you don’t know how to build your query. Who knows, he/she could also learn something new :) Do not hesitate to contact us if you have any question : Doria Hamelryk : doria.hamelryk@gmail.com Fabrice Challier : fabricechallier@gmail.com This presentation and all the queries are available here : bit.ly/cztooling
  31. 31. #CD22 Thank You

More Related Content

More from CzechDreamin

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

×