SlideShare una empresa de Scribd logo
1 de 30
Descargar para leer sin conexión
Adam Olshansky
Salesforce Developer,
Salesforce MVP
AdamToArchitect.com
@adam17amo
Writing Highly Genericized Code
Using Dynamic Apex and the
Tooling API
Adam Olshansky
Salesforce Developer, YouTube
@adam17amo
AdamToArchitect.com
NAMASTE
THANK YOU FOR INVITING
ME TO INDIA!
NAMASTE
Thank you to dQuotient for
sponsoring!
Agenda
• An overview of Generic code for Apex
• Salesforce Dynamic Coding Examples
• Tooling API
Generic Programming in Apex
Who are we talking to today?
• ISV developers
• Don’t know all conditions of customer orgs
• Individual app developers
• May need to accept input from clients/customers
• Any developer accepting user input
• Tailor your queries and results based on user conditions
What problem are we solving for?
● Rigid/Fragile
● Poor (Re)usability
● Lots of patches/quick fixes
● Duplicate code
● Overly complicated data structures
○ Maps of Maps of Maps of…..
○ Managing the data in a 5-D Arrays
2 Different Ways of Writing Code
​Static
​Dynamic/Generic
Different Ways of Writing Code: Static vs Dynamic
Static
• Generated at compile time
• Hard coded
• Doesn’t usually have dependencies
• Works well if you know what’s in the
org
• Most commonly used by developers at
a company developing for their own
org
Dynamic/Generic
• Generated at run time
• Dependent on user input
• May have org-specific dependencies
• Works well if you DON’T know what’s in the
org
• Most commonly used by developers whose
code needs to run in customized orgs
Tradeoffs of Dynamic Coding
Negatives
• More code to write
• More code to test
• Less readabillity
Positives
• More detailed information
• Less chance of an error down the road
• Endless possibilities
Dynamic Coding Examples
Tools of the trade
● Custom Settings/Metadata
● Schema class
● Dynamic Apex
● Dynamic Visualforce
● Dynamic SOQL
● Limits class
Dynamic Apex (Metadata)
Dynamic Apex (Data)
Dynamic Controller
Dynamic Visualforce
Dynamic SOQL
• Don’t always know what parameters are available in a user’s org
• In your org this works fine
Database.query()
Thanks to Dan Appleman, Advanced Apex Programming
• What if your customer doesn’t have record types defined for Lead
Limits Class
• Limits.getDMLRows();
• Limits.getDMLStatements();
• Limits.getHeapSize();
• Limits.getQueries();
• Limits.getQueryRows();
• bit.ly/apexlimitsclass (Apex Limits Class)
Dynamically make adjustments based on limits
Tying it Together
● You know how to design apps efficiently
● You know how to write generic code
● You know how to find information about org metadata
● What’s next?
Tooling API
An API for building...TOOLS
Tooling API Highlights
• Gather finely grained metadata about Apex classes, triggers, and tests in an org
• Classes, triggers, construction of symbol tables
• Query for code coverage, logs, SOQL results
• Query metadata about setup objects
• Business Processes, Flows, Custom items, Workflow components
• Can be utilized for source control/continuous integration
• Metadata containers, deployment details, code file metadata
• Can be queried through REST or SOAP
• Similar to Metadata API but with a ton of additional functionality
Great for building...tools!
Tooling API Examples
Create a class
https://andyinthecloud.com/category/tooling-api/
Additional Tooling API Use Cases
https://andyinthecloud.com/category/tooling-api/
• Show all objects that can be analyzed
• /services/data/v39.0/tooling/sobjects/
• Show list of all classes
• /services/data/v39.0/tooling/apexManifest
• Show all metadata about a class
• /services/data/v39.0/tooling/sobjects/ApexClass/01po0000004SL5b
Another Scenario
UTILIZE DYNAMIC APEX TO WRITE APEX USING APEX!
APEX-CEPTION!!!
Tools To Be Built
● UML Diagram Tool
● Symbol Table Visualizer
● Automated Testing Tools?
● Tools to identify unused code?
● Customize managed packages based
on org’s config
● Use your imagination!
Summary
Next Steps from Here
Summary and Next Steps
• Be thinking about the right type of code for the app you’re building
• Utilize design patterns
• Write dynamic code
• Gather granular details to build any app
• Get out there and build!
Where to Learn More
● Follow @andyinthecloud and his blog!
● Andy Fawcett’s Blog https://andyinthecloud.com/category/tooling-api/
● Andy and James Loghry’s Apex Tooling API Wrapper:
https://github.com/afawcett/apex-toolingapi/
● Pat Patterson’s Java Tooling API Wrapper: https://github.com/metadaddy/force-tooling-demo
https://developer.salesforce.com/blogs/developer-relations/2013/01/new-in-spring-13-the-too
ling-api.html
● Tom Patros VF page Utilizing Symbol Tables (The Documenter):
https://github.com/tompatros/df13-tooling-api-demo
Thank Y u

Más contenido relacionado

La actualidad más candente

GraphQL Munich Meetup #1 - How We Use GraphQL At Commercetools
GraphQL Munich Meetup #1 - How We Use GraphQL At CommercetoolsGraphQL Munich Meetup #1 - How We Use GraphQL At Commercetools
GraphQL Munich Meetup #1 - How We Use GraphQL At CommercetoolsNicola Molinari
 
apidays LIVE Paris 2021 - Localizing OpenAPI Specification by Olga Baybakova,...
apidays LIVE Paris 2021 - Localizing OpenAPI Specification by Olga Baybakova,...apidays LIVE Paris 2021 - Localizing OpenAPI Specification by Olga Baybakova,...
apidays LIVE Paris 2021 - Localizing OpenAPI Specification by Olga Baybakova,...apidays
 
Wrapping and Securing REST APIs with GraphQL
Wrapping and Securing REST APIs with GraphQLWrapping and Securing REST APIs with GraphQL
Wrapping and Securing REST APIs with GraphQLRoy Derks
 
Salesforce Apex Hours : How Lightning Platform Query Optimizer works for LDV
Salesforce Apex Hours : How Lightning Platform Query Optimizer works for LDVSalesforce Apex Hours : How Lightning Platform Query Optimizer works for LDV
Salesforce Apex Hours : How Lightning Platform Query Optimizer works for LDVAmit Chaudhary
 
apidays LIVE London 2021 - Consumer-first APIs in Open Banking by Chris Dudle...
apidays LIVE London 2021 - Consumer-first APIs in Open Banking by Chris Dudle...apidays LIVE London 2021 - Consumer-first APIs in Open Banking by Chris Dudle...
apidays LIVE London 2021 - Consumer-first APIs in Open Banking by Chris Dudle...apidays
 
Using RAML 1.0 Like a Pro
Using RAML 1.0 Like a ProUsing RAML 1.0 Like a Pro
Using RAML 1.0 Like a ProMuleSoft
 
Creating a Business Oriented UI in APEX
Creating a Business Oriented UI in APEXCreating a Business Oriented UI in APEX
Creating a Business Oriented UI in APEXEnkitec
 
GraphQL - Missing Link In REST
GraphQL -  Missing Link In RESTGraphQL -  Missing Link In REST
GraphQL - Missing Link In RESTAnubolu Sreekanth
 
apidays LIVE London 2021 - Designing APIs: Less Data is More by Damir Svrtan,...
apidays LIVE London 2021 - Designing APIs: Less Data is More by Damir Svrtan,...apidays LIVE London 2021 - Designing APIs: Less Data is More by Damir Svrtan,...
apidays LIVE London 2021 - Designing APIs: Less Data is More by Damir Svrtan,...apidays
 
Salesforce Certifications:Explained
Salesforce Certifications:ExplainedSalesforce Certifications:Explained
Salesforce Certifications:ExplainedAtul Gupta(8X)
 
APEX 5 Interactive Reports: Deep Dive and Upgrade Advice
APEX 5 Interactive Reports: Deep Dive and Upgrade AdviceAPEX 5 Interactive Reports: Deep Dive and Upgrade Advice
APEX 5 Interactive Reports: Deep Dive and Upgrade AdviceKaren Cannell
 
Episode 2 conditional flows & loops
Episode 2   conditional flows & loopsEpisode 2   conditional flows & loops
Episode 2 conditional flows & loopsJitendra Zaa
 
AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLE
AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLEAN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLE
AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLEGavin Pickin
 
Introduction to APIs, Integrations and Open Data
Introduction to APIs, Integrations and Open DataIntroduction to APIs, Integrations and Open Data
Introduction to APIs, Integrations and Open DataResolver Inc.
 
Ladies Be Architects - Apex Basics
Ladies Be Architects - Apex BasicsLadies Be Architects - Apex Basics
Ladies Be Architects - Apex Basicsgemziebeth
 
API-first development
API-first developmentAPI-first development
API-first developmentVasco Veloso
 

La actualidad más candente (20)

GraphQL Munich Meetup #1 - How We Use GraphQL At Commercetools
GraphQL Munich Meetup #1 - How We Use GraphQL At CommercetoolsGraphQL Munich Meetup #1 - How We Use GraphQL At Commercetools
GraphQL Munich Meetup #1 - How We Use GraphQL At Commercetools
 
Varun-CV-J
Varun-CV-JVarun-CV-J
Varun-CV-J
 
GraphQL Europe Recap
GraphQL Europe RecapGraphQL Europe Recap
GraphQL Europe Recap
 
apidays LIVE Paris 2021 - Localizing OpenAPI Specification by Olga Baybakova,...
apidays LIVE Paris 2021 - Localizing OpenAPI Specification by Olga Baybakova,...apidays LIVE Paris 2021 - Localizing OpenAPI Specification by Olga Baybakova,...
apidays LIVE Paris 2021 - Localizing OpenAPI Specification by Olga Baybakova,...
 
Wrapping and Securing REST APIs with GraphQL
Wrapping and Securing REST APIs with GraphQLWrapping and Securing REST APIs with GraphQL
Wrapping and Securing REST APIs with GraphQL
 
Salesforce Apex Hours : How Lightning Platform Query Optimizer works for LDV
Salesforce Apex Hours : How Lightning Platform Query Optimizer works for LDVSalesforce Apex Hours : How Lightning Platform Query Optimizer works for LDV
Salesforce Apex Hours : How Lightning Platform Query Optimizer works for LDV
 
apidays LIVE London 2021 - Consumer-first APIs in Open Banking by Chris Dudle...
apidays LIVE London 2021 - Consumer-first APIs in Open Banking by Chris Dudle...apidays LIVE London 2021 - Consumer-first APIs in Open Banking by Chris Dudle...
apidays LIVE London 2021 - Consumer-first APIs in Open Banking by Chris Dudle...
 
Using RAML 1.0 Like a Pro
Using RAML 1.0 Like a ProUsing RAML 1.0 Like a Pro
Using RAML 1.0 Like a Pro
 
Creating a Business Oriented UI in APEX
Creating a Business Oriented UI in APEXCreating a Business Oriented UI in APEX
Creating a Business Oriented UI in APEX
 
Sanjeev rai
Sanjeev raiSanjeev rai
Sanjeev rai
 
GraphQL - Missing Link In REST
GraphQL -  Missing Link In RESTGraphQL -  Missing Link In REST
GraphQL - Missing Link In REST
 
apidays LIVE London 2021 - Designing APIs: Less Data is More by Damir Svrtan,...
apidays LIVE London 2021 - Designing APIs: Less Data is More by Damir Svrtan,...apidays LIVE London 2021 - Designing APIs: Less Data is More by Damir Svrtan,...
apidays LIVE London 2021 - Designing APIs: Less Data is More by Damir Svrtan,...
 
Salesforce Certifications:Explained
Salesforce Certifications:ExplainedSalesforce Certifications:Explained
Salesforce Certifications:Explained
 
APEX 5 Interactive Reports: Deep Dive and Upgrade Advice
APEX 5 Interactive Reports: Deep Dive and Upgrade AdviceAPEX 5 Interactive Reports: Deep Dive and Upgrade Advice
APEX 5 Interactive Reports: Deep Dive and Upgrade Advice
 
Episode 2 conditional flows & loops
Episode 2   conditional flows & loopsEpisode 2   conditional flows & loops
Episode 2 conditional flows & loops
 
Domain Driven design
Domain Driven design Domain Driven design
Domain Driven design
 
AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLE
AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLEAN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLE
AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLE
 
Introduction to APIs, Integrations and Open Data
Introduction to APIs, Integrations and Open DataIntroduction to APIs, Integrations and Open Data
Introduction to APIs, Integrations and Open Data
 
Ladies Be Architects - Apex Basics
Ladies Be Architects - Apex BasicsLadies Be Architects - Apex Basics
Ladies Be Architects - Apex Basics
 
API-first development
API-first developmentAPI-first development
API-first development
 

Similar a Write Generic Code with the Tooling API

Single Source of Truth for Network Automation
Single Source of Truth for Network AutomationSingle Source of Truth for Network Automation
Single Source of Truth for Network AutomationAndy Davidson
 
Proud to be polyglot
Proud to be polyglotProud to be polyglot
Proud to be polyglotTugdual Grall
 
API Description Languages
API Description LanguagesAPI Description Languages
API Description LanguagesAkana
 
API Description Languages
API Description LanguagesAPI Description Languages
API Description LanguagesAkana
 
(ATS6-DEV02) Web Application Strategies
(ATS6-DEV02) Web Application Strategies(ATS6-DEV02) Web Application Strategies
(ATS6-DEV02) Web Application StrategiesBIOVIA
 
Basic Application Performance Optimization Techniques (Backend)
Basic Application Performance Optimization Techniques (Backend)Basic Application Performance Optimization Techniques (Backend)
Basic Application Performance Optimization Techniques (Backend)Klas Berlič Fras
 
APIs and SDKs: Breaking into and Succeeding in a Specialty Market
APIs and SDKs: Breaking into and Succeeding in a Specialty MarketAPIs and SDKs: Breaking into and Succeeding in a Specialty Market
APIs and SDKs: Breaking into and Succeeding in a Specialty MarketSTC-Philadelphia Metro Chapter
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium SuccessfullyDave Haeffner
 
Practices and tools for building better APIs
Practices and tools for building better APIsPractices and tools for building better APIs
Practices and tools for building better APIsNLJUG
 
Practices and tools for building better API (JFall 2013)
Practices and tools for building better API (JFall 2013)Practices and tools for building better API (JFall 2013)
Practices and tools for building better API (JFall 2013)Peter Hendriks
 
How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...
How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...
How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...Malin Weiss
 
JavaOne2016 - How to Generate Customized Java 8 Code from Your Database [TUT4...
JavaOne2016 - How to Generate Customized Java 8 Code from Your Database [TUT4...JavaOne2016 - How to Generate Customized Java 8 Code from Your Database [TUT4...
JavaOne2016 - How to Generate Customized Java 8 Code from Your Database [TUT4...Speedment, Inc.
 
The Characteristics of a Successful SPA
The Characteristics of a Successful SPAThe Characteristics of a Successful SPA
The Characteristics of a Successful SPAGil Fink
 
Practices and Tools for Building Better APIs
Practices and Tools for Building Better APIsPractices and Tools for Building Better APIs
Practices and Tools for Building Better APIsPeter Hendriks
 
Presentacion day f-core v1.2.1.2-technical - english
Presentacion day f-core v1.2.1.2-technical - englishPresentacion day f-core v1.2.1.2-technical - english
Presentacion day f-core v1.2.1.2-technical - englishJose Luis Sanchez del Coso
 
How to create custom dashboards in Elastic Search / Kibana with Performance V...
How to create custom dashboards in Elastic Search / Kibana with Performance V...How to create custom dashboards in Elastic Search / Kibana with Performance V...
How to create custom dashboards in Elastic Search / Kibana with Performance V...PerformanceVision (previously SecurActive)
 
API workshop: Introduction to APIs (TC Camp)
API workshop: Introduction to APIs (TC Camp)API workshop: Introduction to APIs (TC Camp)
API workshop: Introduction to APIs (TC Camp)Tom Johnson
 
APIs and SDKs: Breaking Into and Succeeding in a Specialty Market
APIs and SDKs: Breaking Into and Succeeding in a Specialty MarketAPIs and SDKs: Breaking Into and Succeeding in a Specialty Market
APIs and SDKs: Breaking Into and Succeeding in a Specialty MarketScott Abel
 
Five Ways to Scale your API Without Touching Your Code
Five Ways to Scale your API Without Touching Your CodeFive Ways to Scale your API Without Touching Your Code
Five Ways to Scale your API Without Touching Your Code3scale
 

Similar a Write Generic Code with the Tooling API (20)

Single Source of Truth for Network Automation
Single Source of Truth for Network AutomationSingle Source of Truth for Network Automation
Single Source of Truth for Network Automation
 
Proud to be polyglot
Proud to be polyglotProud to be polyglot
Proud to be polyglot
 
API Description Languages
API Description LanguagesAPI Description Languages
API Description Languages
 
API Description Languages
API Description LanguagesAPI Description Languages
API Description Languages
 
(ATS6-DEV02) Web Application Strategies
(ATS6-DEV02) Web Application Strategies(ATS6-DEV02) Web Application Strategies
(ATS6-DEV02) Web Application Strategies
 
Basic Application Performance Optimization Techniques (Backend)
Basic Application Performance Optimization Techniques (Backend)Basic Application Performance Optimization Techniques (Backend)
Basic Application Performance Optimization Techniques (Backend)
 
APIs and SDKs: Breaking into and Succeeding in a Specialty Market
APIs and SDKs: Breaking into and Succeeding in a Specialty MarketAPIs and SDKs: Breaking into and Succeeding in a Specialty Market
APIs and SDKs: Breaking into and Succeeding in a Specialty Market
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium Successfully
 
Practices and tools for building better APIs
Practices and tools for building better APIsPractices and tools for building better APIs
Practices and tools for building better APIs
 
Practices and tools for building better API (JFall 2013)
Practices and tools for building better API (JFall 2013)Practices and tools for building better API (JFall 2013)
Practices and tools for building better API (JFall 2013)
 
How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...
How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...
How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...
 
JavaOne2016 - How to Generate Customized Java 8 Code from Your Database [TUT4...
JavaOne2016 - How to Generate Customized Java 8 Code from Your Database [TUT4...JavaOne2016 - How to Generate Customized Java 8 Code from Your Database [TUT4...
JavaOne2016 - How to Generate Customized Java 8 Code from Your Database [TUT4...
 
The Characteristics of a Successful SPA
The Characteristics of a Successful SPAThe Characteristics of a Successful SPA
The Characteristics of a Successful SPA
 
Practices and Tools for Building Better APIs
Practices and Tools for Building Better APIsPractices and Tools for Building Better APIs
Practices and Tools for Building Better APIs
 
Presentacion day f-core v1.2.1.2-technical - english
Presentacion day f-core v1.2.1.2-technical - englishPresentacion day f-core v1.2.1.2-technical - english
Presentacion day f-core v1.2.1.2-technical - english
 
How to create custom dashboards in Elastic Search / Kibana with Performance V...
How to create custom dashboards in Elastic Search / Kibana with Performance V...How to create custom dashboards in Elastic Search / Kibana with Performance V...
How to create custom dashboards in Elastic Search / Kibana with Performance V...
 
API workshop: Introduction to APIs (TC Camp)
API workshop: Introduction to APIs (TC Camp)API workshop: Introduction to APIs (TC Camp)
API workshop: Introduction to APIs (TC Camp)
 
API ARU-ARU
API ARU-ARUAPI ARU-ARU
API ARU-ARU
 
APIs and SDKs: Breaking Into and Succeeding in a Specialty Market
APIs and SDKs: Breaking Into and Succeeding in a Specialty MarketAPIs and SDKs: Breaking Into and Succeeding in a Specialty Market
APIs and SDKs: Breaking Into and Succeeding in a Specialty Market
 
Five Ways to Scale your API Without Touching Your Code
Five Ways to Scale your API Without Touching Your CodeFive Ways to Scale your API Without Touching Your Code
Five Ways to Scale your API Without Touching Your Code
 

Más de Adam Olshansky

Apex Testing Deep Dive
Apex Testing Deep DiveApex Testing Deep Dive
Apex Testing Deep DiveAdam Olshansky
 
Maximize Apex Performance with Platform Cache
Maximize Apex Performance with Platform CacheMaximize Apex Performance with Platform Cache
Maximize Apex Performance with Platform CacheAdam Olshansky
 
Lightning Components 101: An Apex Developer's Guide
Lightning Components 101: An Apex Developer's GuideLightning Components 101: An Apex Developer's Guide
Lightning Components 101: An Apex Developer's GuideAdam Olshansky
 
Demystifying Code for Admins: The Last Step to Apex
Demystifying Code for Admins: The Last Step to ApexDemystifying Code for Admins: The Last Step to Apex
Demystifying Code for Admins: The Last Step to ApexAdam Olshansky
 
Force Academy LA Trigger Framework
Force Academy LA Trigger FrameworkForce Academy LA Trigger Framework
Force Academy LA Trigger FrameworkAdam Olshansky
 
Phx User Group Salesforce Connect
Phx User Group Salesforce ConnectPhx User Group Salesforce Connect
Phx User Group Salesforce ConnectAdam Olshansky
 

Más de Adam Olshansky (7)

Apex Testing Deep Dive
Apex Testing Deep DiveApex Testing Deep Dive
Apex Testing Deep Dive
 
Maximize Apex Performance with Platform Cache
Maximize Apex Performance with Platform CacheMaximize Apex Performance with Platform Cache
Maximize Apex Performance with Platform Cache
 
Lightning Components 101: An Apex Developer's Guide
Lightning Components 101: An Apex Developer's GuideLightning Components 101: An Apex Developer's Guide
Lightning Components 101: An Apex Developer's Guide
 
Demystifying Code for Admins: The Last Step to Apex
Demystifying Code for Admins: The Last Step to ApexDemystifying Code for Admins: The Last Step to Apex
Demystifying Code for Admins: The Last Step to Apex
 
Force Academy LA Trigger Framework
Force Academy LA Trigger FrameworkForce Academy LA Trigger Framework
Force Academy LA Trigger Framework
 
Blaze Your Trail
Blaze Your TrailBlaze Your Trail
Blaze Your Trail
 
Phx User Group Salesforce Connect
Phx User Group Salesforce ConnectPhx User Group Salesforce Connect
Phx User Group Salesforce Connect
 

Último

Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 

Último (20)

Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 

Write Generic Code with the Tooling API

  • 1. Adam Olshansky Salesforce Developer, Salesforce MVP AdamToArchitect.com @adam17amo Writing Highly Genericized Code Using Dynamic Apex and the Tooling API
  • 2. Adam Olshansky Salesforce Developer, YouTube @adam17amo AdamToArchitect.com
  • 3. NAMASTE THANK YOU FOR INVITING ME TO INDIA!
  • 4. NAMASTE Thank you to dQuotient for sponsoring!
  • 5. Agenda • An overview of Generic code for Apex • Salesforce Dynamic Coding Examples • Tooling API
  • 7. Who are we talking to today? • ISV developers • Don’t know all conditions of customer orgs • Individual app developers • May need to accept input from clients/customers • Any developer accepting user input • Tailor your queries and results based on user conditions
  • 8. What problem are we solving for? ● Rigid/Fragile ● Poor (Re)usability ● Lots of patches/quick fixes ● Duplicate code ● Overly complicated data structures ○ Maps of Maps of Maps of….. ○ Managing the data in a 5-D Arrays
  • 9. 2 Different Ways of Writing Code ​Static ​Dynamic/Generic
  • 10. Different Ways of Writing Code: Static vs Dynamic Static • Generated at compile time • Hard coded • Doesn’t usually have dependencies • Works well if you know what’s in the org • Most commonly used by developers at a company developing for their own org Dynamic/Generic • Generated at run time • Dependent on user input • May have org-specific dependencies • Works well if you DON’T know what’s in the org • Most commonly used by developers whose code needs to run in customized orgs
  • 11. Tradeoffs of Dynamic Coding Negatives • More code to write • More code to test • Less readabillity Positives • More detailed information • Less chance of an error down the road • Endless possibilities
  • 13. Tools of the trade ● Custom Settings/Metadata ● Schema class ● Dynamic Apex ● Dynamic Visualforce ● Dynamic SOQL ● Limits class
  • 18. Dynamic SOQL • Don’t always know what parameters are available in a user’s org • In your org this works fine Database.query() Thanks to Dan Appleman, Advanced Apex Programming • What if your customer doesn’t have record types defined for Lead
  • 19. Limits Class • Limits.getDMLRows(); • Limits.getDMLStatements(); • Limits.getHeapSize(); • Limits.getQueries(); • Limits.getQueryRows(); • bit.ly/apexlimitsclass (Apex Limits Class) Dynamically make adjustments based on limits
  • 20. Tying it Together ● You know how to design apps efficiently ● You know how to write generic code ● You know how to find information about org metadata ● What’s next?
  • 21. Tooling API An API for building...TOOLS
  • 22. Tooling API Highlights • Gather finely grained metadata about Apex classes, triggers, and tests in an org • Classes, triggers, construction of symbol tables • Query for code coverage, logs, SOQL results • Query metadata about setup objects • Business Processes, Flows, Custom items, Workflow components • Can be utilized for source control/continuous integration • Metadata containers, deployment details, code file metadata • Can be queried through REST or SOAP • Similar to Metadata API but with a ton of additional functionality Great for building...tools!
  • 23. Tooling API Examples Create a class https://andyinthecloud.com/category/tooling-api/
  • 24. Additional Tooling API Use Cases https://andyinthecloud.com/category/tooling-api/ • Show all objects that can be analyzed • /services/data/v39.0/tooling/sobjects/ • Show list of all classes • /services/data/v39.0/tooling/apexManifest • Show all metadata about a class • /services/data/v39.0/tooling/sobjects/ApexClass/01po0000004SL5b
  • 25. Another Scenario UTILIZE DYNAMIC APEX TO WRITE APEX USING APEX! APEX-CEPTION!!!
  • 26. Tools To Be Built ● UML Diagram Tool ● Symbol Table Visualizer ● Automated Testing Tools? ● Tools to identify unused code? ● Customize managed packages based on org’s config ● Use your imagination!
  • 28. Summary and Next Steps • Be thinking about the right type of code for the app you’re building • Utilize design patterns • Write dynamic code • Gather granular details to build any app • Get out there and build!
  • 29. Where to Learn More ● Follow @andyinthecloud and his blog! ● Andy Fawcett’s Blog https://andyinthecloud.com/category/tooling-api/ ● Andy and James Loghry’s Apex Tooling API Wrapper: https://github.com/afawcett/apex-toolingapi/ ● Pat Patterson’s Java Tooling API Wrapper: https://github.com/metadaddy/force-tooling-demo https://developer.salesforce.com/blogs/developer-relations/2013/01/new-in-spring-13-the-too ling-api.html ● Tom Patros VF page Utilizing Symbol Tables (The Documenter): https://github.com/tompatros/df13-tooling-api-demo