SlideShare a Scribd company logo
1 of 15
Download to read offline
Presentation Title Date 
Best practices in using Salesforce 
Meta Data API 
Naveen Gabrani 
CEO Astrea IT Services 
ngabrani At astreait.com 
@ngabrani 
Copyright Salesforce 2014. Legal Terms and more here. 
Sanchit Dua 
Senior Software Developer Astrea IT Services 
@Sanchit1 
Naveen Gabrani 
CEO Astrea IT Services 
ngabrani At astreait.com
Presentation Title Date 
Copyright Salesforce 2014. Legal Terms and more here. 
Sanchit Dua 
Senior Software Developer Astrea IT Services 
Agenda 
1. What is Metadata 
2. What is Metadata API 
3. How can I access it? 
4. Two type of Metadata operations 
5. Common applications of the Metadata API 
6. Development Scenarios and correct implementation 
7. Best Practices and common issues
Presentation Title Date 
What is Metadata 
 Data: Some thing that is stored in database (accounts) 
 Metadata: Configuration/Code describes how the application looks 
 Shapes the functionality of your specific applications 
 Controls logic and presentation 
What is Metadata API 
 Programmable interface to access Salesforce Metadata 
 Allows you to review/update Metadata components 
 Supported from all modern languages like .Net, Java, PHP 
 Allows you to get/update XML version of an Org 
 SOAP based 
 Supports both Synchronous and Asynchronous invocation 
 Synchronous support added in Summer ’13 
Copyright Salesforce 2014. Legal Terms and more here.
Presentation Title Date 
Applications of Metadata API 
 Standard Salesforce tools written using Metadata API 
 Eclipse IDE 
 ANT Migration tool 
 Data loader 
 Standard configuration on all your customer instances 
 Java screens to create Salesforce objects, fields, validation rules etc 
 Regular backup of configuration 
Metadata Components 
Metadata components 
 Object and Field definitions 
 Visualforce pages 
 Page Layouts 
 Validation rules 
 Apex 
 Workflows 
 Profiles 
 Reports 
Copyright Salesforce 2014. Legal Terms and more here.
Presentation Title Date 
Metadata API 
CRUD Operations File Based (Declarative) 
Copyright Salesforce 2014. Legal Terms and more here. 
Metadata 
Use this to create/update 
Metadata elements like Objects 
Use this for deploying 
Metadata from one Salesforce 
instance to another 
More Granular Deploy() and Retrieve() 
CRUD based web services 
 Used to create, delete, update sets of Metadata components 
 Create a field 
 Create an object 
 Create a page layout 
 Setting Field Level Security 
 Synchronous Methods as of v-31 (Summer ’14) 
 createMetadata() 
 deleteMetadata() 
 udpateMetadata() 
 upsertMetadata()
Presentation Title Date 
create() flow 
User SFDC 
Copyright Salesforce 2014. Legal Terms and more here. 
AsyncResult object generated. 
Includes ID 
create(new CustomObject(“MyObject”)) 
Return Async Result 
CheckStatus(ID) = done? 
Return Deploy Messages 
CustomObject co = new CustomObject(); 
co.setFullName(uniqueName); 
co.setDeploymentStatus(DeploymentStatus.Deployed 
); 
co.setDescription("Created by Sanchit"); 
co.setEnableActivities(true); 
co.setLabel(label); 
co.setPluralLabel(label + "s"); 
co.setSharingModel(SharingModel.ReadWrite); 
AsyncResult[] results = 
metadataConnection.create(new Metadata[] { co }); 
User 
SFDC CustomObject is <xsd: extension 
base=“tns:Metadata”> 
File based Metadata call 
 File-based Metadata calls 
 Retrieve and deploy XML representations of Metadata 
 Can be used to deploy Metadata from one instance to another 
 Requires package.xml 
 Specifies type of component 
 Specifies names of component
Presentation Title Date 
A typical custom object example 
{File Name: CustomObject/MyObject__c} 
<?xml version="1.0" encoding="UTF-8"?> 
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata"> 
<deploymentStatus>Deployed</deploymentStatus> 
<fields> 
<fullName>Due_Date__c</fullName> 
<defaultValue>TODAY() + 3</defaultValue> 
<label>Due Date</label> 
<type>Date</type> 
</fields> 
<sharingModel>ReadWrite</sharingModel> 
<recordTypes> 
<fullName>Classification</fullName> 
<active>true</active> 
<description>Classification Records</description> 
<label>Classification</label> 
</recordTypes> 
<recordTypes> 
<fullName>Client_Code</fullName> 
<active>true</active> 
<description>Client Code Records</description> 
<label>Client Code</label> 
</recordTypes> 
</CustomObject> 
Create 
your 
Database 
Tables 
Create 
your 
Database 
Fields 
Copyright Salesforce 2014. Legal Terms and more here. 
Define 
Schema 
attributes 
Metadata API and SOAP API 
Metadata 
Data 
Metadata 
Data 
Metadata 
API 
Web 
Services 
API 
Metadata 
API 
Web 
Services 
API
Presentation Title Date 
Setting up infrastructure 
1. Download the latest WSC – Web Service Connector 
2. From Setup->API 
Enterprise WSDL 
Metadata WSDL 
3. Generate the Jar files from WSDL 
4. Set the classpath of the Application. 
Establishing Connection 
1. Use ConnectorConfig class to set end point to 
https://login.salesforce.com/services/Soap/c/31.0 
2. Use EnterpriseConnection to specify user name and password to login 
3. Initialize Metadata component – e.g CustomObject, CustomField etc. 
4. Pass the Metadata component to create() / update() / delete() call. 
Copyright Salesforce 2014. Legal Terms and more here.
Presentation Title Date 
Best Practices and common issues 
Development Scenarios 
 Setting the Page Layout 
 Editing the Profile 
 Creating Record Types 
Enforcing rules at runtime involves recompiling of code (with associated 
possibility of compile time errors). 
Copyright Salesforce 2014. Legal Terms and more here.
Presentation Title Date 
Profile Edits 
Configuring a Profile: 
 Open a profile 
 Edit configurations 
NOTE 
 It’s a complex task to achieve via coding without knowing listMetadata() or Workbench. 
 Default Result of listMetadata() as: 
SolutionManager 
Customer Portal Manager 
Standard StandardAul 
Standard 
Chatter Free User 
Chatter External User 
Copyright Salesforce 2014. Legal Terms and more here. 
Admin 
Force%2Ecom - Free User 
MarketingProfile 
Custom%3A Marketing Profile 
HighVolumePortal 
Record Types Creation 
Generally available steps 
 Add a record Type 
 Assign it to layouts and profiles 
 Clicking new on the object view 
NOTE 
 This case is very easily done on declarative platform 
 Doing this via Metadata API is relatively complex
Presentation Title Date 
Insufficient Access On Cross Reference Entity 
 An exception 
 Using Create, Update and Delete 
 Occurs using record type id 
Copyright Salesforce 2014. Legal Terms and more here. 
Demo
Presentation Title Date 
A quirk using Ant Migration Tool 
 Using destructiveChanges.xml 
 To delete a field of type picklist we can’t delete the values instead we delete the 
whole field. 
 This is the limitation of Metadata API. 
Tooling API 
 The tooling API is designed for developing user interface tools to interact with 
the development artifacts in orgs. 
 It can be accessed via SOAP and REST. 
 Developer Console is largely built on the tooling API 
 Best used in conjunction with the Metadata API as a junction. 
Copyright Salesforce 2014. Legal Terms and more here.
Presentation Title Date 
Recap 
 Metadata API gives you flexibility to manipulate Salesforce instance 
from outside the platform 
 Two types of Metadata API 
 CRUD based 
 Declarative 
 Application Business process code needs to mimic the user interface 
flow 
 Record Type Creations 
 Profile Edits 
 More important than ever that you define and enforce the boundaries 
 You should respect the intent of platform configurations and not 
surface data in ways that is not permitted. 
Resources 
 Metadata API Developer’s Guide 
 http://www.salesforce.com/us/developer/docs/api_meta 
 https://developer.salesforce.com/en/events/webinars/metadata-api 
 salesforce.stackexchange.com 
Copyright Salesforce 2014. Legal Terms and more here.
Presentation Title Date 
Resources 
 Metadata API Developer’s Guide 
 http://www.salesforce.com/us/developer/docs/api_meta 
 https://developer.salesforce.com/en/events/webinars/metadata-api 
 salesforce.stackexchange.com 
 https://github.com/sanchitdua/md_java_asynchronous 
 https://github.com/sanchitdua/md_java_synchronous 
Copyright Salesforce 2014. Legal Terms and more here. 
Q&A
Presentation Title Date 
Copyright Salesforce 2014. Legal Terms and more here.

More Related Content

What's hot

Importing data to salesforce
Importing data to salesforceImporting data to salesforce
Importing data to salesforceNetStronghold
 
oracle oa framework training | oracle oa framework training courses | oa fram...
oracle oa framework training | oracle oa framework training courses | oa fram...oracle oa framework training | oracle oa framework training courses | oa fram...
oracle oa framework training | oracle oa framework training courses | oa fram...Nancy Thomas
 
Oracle ADF Overview for Beginners
Oracle ADF Overview for BeginnersOracle ADF Overview for Beginners
Oracle ADF Overview for BeginnersJithin Kuriakose
 
OData, External objects & Lightning Connect
OData, External objects & Lightning ConnectOData, External objects & Lightning Connect
OData, External objects & Lightning ConnectPrasanna Deshpande ☁
 
JAX-RS 2.0 and OData
JAX-RS 2.0 and ODataJAX-RS 2.0 and OData
JAX-RS 2.0 and ODataAnil Allewar
 
Infolets and OTBI Deep link Actionable Reports - Configuration Work Book
Infolets and OTBI Deep link Actionable Reports - Configuration Work Book Infolets and OTBI Deep link Actionable Reports - Configuration Work Book
Infolets and OTBI Deep link Actionable Reports - Configuration Work Book Feras Ahmad
 
SAP ODATA Overview & Guidelines
SAP ODATA Overview & GuidelinesSAP ODATA Overview & Guidelines
SAP ODATA Overview & GuidelinesAshish Saxena
 
Android SharePoint
Android SharePointAndroid SharePoint
Android SharePointBenCox35
 
Apex basics-for Beginners
Apex basics-for BeginnersApex basics-for Beginners
Apex basics-for Beginnershrakhra
 
UI5Con presentation on UI5 OData V4 Model
UI5Con presentation on UI5 OData V4 ModelUI5Con presentation on UI5 OData V4 Model
UI5Con presentation on UI5 OData V4 ModelPatric Ksinsik
 
Rational Publishing Engine and Rational RequisitePro
Rational Publishing Engine and Rational  RequisiteProRational Publishing Engine and Rational  RequisitePro
Rational Publishing Engine and Rational RequisiteProGEBS Reporting
 
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)Pat Patterson
 
Odata - Open Data Protocol
Odata - Open Data ProtocolOdata - Open Data Protocol
Odata - Open Data ProtocolKhaled Musaied
 
Salesforce Coding techniques that keep your admins happy (DF13)
Salesforce Coding techniques that keep your admins happy (DF13)Salesforce Coding techniques that keep your admins happy (DF13)
Salesforce Coding techniques that keep your admins happy (DF13)Roy Gilad
 
Azure data factory security
Azure data factory securityAzure data factory security
Azure data factory securityMikeBrassil1
 

What's hot (20)

Importing data to salesforce
Importing data to salesforceImporting data to salesforce
Importing data to salesforce
 
oracle oa framework training | oracle oa framework training courses | oa fram...
oracle oa framework training | oracle oa framework training courses | oa fram...oracle oa framework training | oracle oa framework training courses | oa fram...
oracle oa framework training | oracle oa framework training courses | oa fram...
 
Oracle ADF Overview for Beginners
Oracle ADF Overview for BeginnersOracle ADF Overview for Beginners
Oracle ADF Overview for Beginners
 
OData, External objects & Lightning Connect
OData, External objects & Lightning ConnectOData, External objects & Lightning Connect
OData, External objects & Lightning Connect
 
Oracle application framework (oaf) online training
Oracle application framework (oaf) online trainingOracle application framework (oaf) online training
Oracle application framework (oaf) online training
 
uppada_kishore_resume (1)
uppada_kishore_resume (1)uppada_kishore_resume (1)
uppada_kishore_resume (1)
 
Extensions in OAF
Extensions in OAF Extensions in OAF
Extensions in OAF
 
JAX-RS 2.0 and OData
JAX-RS 2.0 and ODataJAX-RS 2.0 and OData
JAX-RS 2.0 and OData
 
Infolets and OTBI Deep link Actionable Reports - Configuration Work Book
Infolets and OTBI Deep link Actionable Reports - Configuration Work Book Infolets and OTBI Deep link Actionable Reports - Configuration Work Book
Infolets and OTBI Deep link Actionable Reports - Configuration Work Book
 
Practical OData
Practical ODataPractical OData
Practical OData
 
SAP ODATA Overview & Guidelines
SAP ODATA Overview & GuidelinesSAP ODATA Overview & Guidelines
SAP ODATA Overview & Guidelines
 
Android SharePoint
Android SharePointAndroid SharePoint
Android SharePoint
 
Apex basics-for Beginners
Apex basics-for BeginnersApex basics-for Beginners
Apex basics-for Beginners
 
UI5Con presentation on UI5 OData V4 Model
UI5Con presentation on UI5 OData V4 ModelUI5Con presentation on UI5 OData V4 Model
UI5Con presentation on UI5 OData V4 Model
 
Rational Publishing Engine and Rational RequisitePro
Rational Publishing Engine and Rational  RequisiteProRational Publishing Engine and Rational  RequisitePro
Rational Publishing Engine and Rational RequisitePro
 
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
 
Odata - Open Data Protocol
Odata - Open Data ProtocolOdata - Open Data Protocol
Odata - Open Data Protocol
 
Salesforce Coding techniques that keep your admins happy (DF13)
Salesforce Coding techniques that keep your admins happy (DF13)Salesforce Coding techniques that keep your admins happy (DF13)
Salesforce Coding techniques that keep your admins happy (DF13)
 
Azure data factory security
Azure data factory securityAzure data factory security
Azure data factory security
 
Oracle application-development-framework-best-practices
Oracle application-development-framework-best-practicesOracle application-development-framework-best-practices
Oracle application-development-framework-best-practices
 

Viewers also liked

2013 Non-Profit Industry Guide to Dreamforce
2013 Non-Profit Industry Guide to Dreamforce2013 Non-Profit Industry Guide to Dreamforce
2013 Non-Profit Industry Guide to DreamforceSalesforce.org
 
2013 Higher Education Industry Guide to Dreamforce
2013 Higher Education Industry Guide to Dreamforce2013 Higher Education Industry Guide to Dreamforce
2013 Higher Education Industry Guide to DreamforceSalesforce.org
 
Where Marketing Meets CRM
Where Marketing Meets CRMWhere Marketing Meets CRM
Where Marketing Meets CRMSalesforce.org
 
Administrer Salesforce
Administrer SalesforceAdministrer Salesforce
Administrer SalesforceAxel KAMALAK
 
Social Engagement Powering the Connected Nonprofit & Connected Campus
Social Engagement Powering the Connected Nonprofit & Connected CampusSocial Engagement Powering the Connected Nonprofit & Connected Campus
Social Engagement Powering the Connected Nonprofit & Connected CampusSalesforce.org
 
10 Examples of Community Engagement in Higher Ed
10 Examples of Community Engagement in Higher Ed10 Examples of Community Engagement in Higher Ed
10 Examples of Community Engagement in Higher EdSalesforce.org
 
Heroku 101 py con 2015 - David Gouldin
Heroku 101   py con 2015 - David GouldinHeroku 101   py con 2015 - David Gouldin
Heroku 101 py con 2015 - David GouldinHeroku
 
Heroku Connect - Synchronisez Heroku et Salesforce en 5 minutes chrono
Heroku Connect - Synchronisez Heroku et Salesforce en 5 minutes chronoHeroku Connect - Synchronisez Heroku et Salesforce en 5 minutes chrono
Heroku Connect - Synchronisez Heroku et Salesforce en 5 minutes chronoSylpheo
 
Salesforce.org Higher Ed Summit 2016 Keynote
Salesforce.org Higher Ed Summit 2016 KeynoteSalesforce.org Higher Ed Summit 2016 Keynote
Salesforce.org Higher Ed Summit 2016 KeynoteSalesforce.org
 
Intro to the Higher Education Advisory Council
Intro to the Higher Education Advisory CouncilIntro to the Higher Education Advisory Council
Intro to the Higher Education Advisory CouncilSalesforce.org
 
Salesforce for Nonprofits: Turn Big Data into Social Change
Salesforce for Nonprofits: Turn Big Data into Social ChangeSalesforce for Nonprofits: Turn Big Data into Social Change
Salesforce for Nonprofits: Turn Big Data into Social ChangeSalesforce.org
 
Understanding Multitenancy and the Architecture of the Salesforce Platform
Understanding Multitenancy and the Architecture of the Salesforce PlatformUnderstanding Multitenancy and the Architecture of the Salesforce Platform
Understanding Multitenancy and the Architecture of the Salesforce PlatformSalesforce Developers
 
Enterprise Architecture Salesforce
Enterprise Architecture SalesforceEnterprise Architecture Salesforce
Enterprise Architecture SalesforcePeter Doolan
 
Salesforce Multitenant Architecture: How We Do the Magic We Do
Salesforce Multitenant Architecture: How We Do the Magic We DoSalesforce Multitenant Architecture: How We Do the Magic We Do
Salesforce Multitenant Architecture: How We Do the Magic We DoSalesforce Developers
 
Salesforce com-architecture
Salesforce com-architectureSalesforce com-architecture
Salesforce com-architecturedrewz lin
 
Salesforce Presentation
Salesforce PresentationSalesforce Presentation
Salesforce PresentationChetna Purohit
 

Viewers also liked (17)

2013 Non-Profit Industry Guide to Dreamforce
2013 Non-Profit Industry Guide to Dreamforce2013 Non-Profit Industry Guide to Dreamforce
2013 Non-Profit Industry Guide to Dreamforce
 
2013 Higher Education Industry Guide to Dreamforce
2013 Higher Education Industry Guide to Dreamforce2013 Higher Education Industry Guide to Dreamforce
2013 Higher Education Industry Guide to Dreamforce
 
Where Marketing Meets CRM
Where Marketing Meets CRMWhere Marketing Meets CRM
Where Marketing Meets CRM
 
Administrer Salesforce
Administrer SalesforceAdministrer Salesforce
Administrer Salesforce
 
Social Engagement Powering the Connected Nonprofit & Connected Campus
Social Engagement Powering the Connected Nonprofit & Connected CampusSocial Engagement Powering the Connected Nonprofit & Connected Campus
Social Engagement Powering the Connected Nonprofit & Connected Campus
 
10 Examples of Community Engagement in Higher Ed
10 Examples of Community Engagement in Higher Ed10 Examples of Community Engagement in Higher Ed
10 Examples of Community Engagement in Higher Ed
 
Heroku 101 py con 2015 - David Gouldin
Heroku 101   py con 2015 - David GouldinHeroku 101   py con 2015 - David Gouldin
Heroku 101 py con 2015 - David Gouldin
 
Heroku Connect - Synchronisez Heroku et Salesforce en 5 minutes chrono
Heroku Connect - Synchronisez Heroku et Salesforce en 5 minutes chronoHeroku Connect - Synchronisez Heroku et Salesforce en 5 minutes chrono
Heroku Connect - Synchronisez Heroku et Salesforce en 5 minutes chrono
 
Salesforce.org Higher Ed Summit 2016 Keynote
Salesforce.org Higher Ed Summit 2016 KeynoteSalesforce.org Higher Ed Summit 2016 Keynote
Salesforce.org Higher Ed Summit 2016 Keynote
 
Intro to the Higher Education Advisory Council
Intro to the Higher Education Advisory CouncilIntro to the Higher Education Advisory Council
Intro to the Higher Education Advisory Council
 
Salesforce for Nonprofits: Turn Big Data into Social Change
Salesforce for Nonprofits: Turn Big Data into Social ChangeSalesforce for Nonprofits: Turn Big Data into Social Change
Salesforce for Nonprofits: Turn Big Data into Social Change
 
Understanding Multitenancy and the Architecture of the Salesforce Platform
Understanding Multitenancy and the Architecture of the Salesforce PlatformUnderstanding Multitenancy and the Architecture of the Salesforce Platform
Understanding Multitenancy and the Architecture of the Salesforce Platform
 
Enterprise Architecture Salesforce
Enterprise Architecture SalesforceEnterprise Architecture Salesforce
Enterprise Architecture Salesforce
 
Data model in salesforce
Data model in salesforceData model in salesforce
Data model in salesforce
 
Salesforce Multitenant Architecture: How We Do the Magic We Do
Salesforce Multitenant Architecture: How We Do the Magic We DoSalesforce Multitenant Architecture: How We Do the Magic We Do
Salesforce Multitenant Architecture: How We Do the Magic We Do
 
Salesforce com-architecture
Salesforce com-architectureSalesforce com-architecture
Salesforce com-architecture
 
Salesforce Presentation
Salesforce PresentationSalesforce Presentation
Salesforce Presentation
 

Similar to Best practices in using Salesforce Metadata API

Best practices in using Salesforce Metadata API
Best practices in using Salesforce Metadata APIBest practices in using Salesforce Metadata API
Best practices in using Salesforce Metadata APISanchit Dua
 
Advanced Web Development
Advanced Web DevelopmentAdvanced Web Development
Advanced Web DevelopmentRobert J. Stein
 
Mike Taulty MIX10 Silverlight Frameworks and Patterns
Mike Taulty MIX10 Silverlight Frameworks and PatternsMike Taulty MIX10 Silverlight Frameworks and Patterns
Mike Taulty MIX10 Silverlight Frameworks and Patternsukdpe
 
Punta Dreaming by Luciano Straga #pd17 - Punta del Este, Uruguay
Punta Dreaming by Luciano Straga #pd17 - Punta del Este, UruguayPunta Dreaming by Luciano Straga #pd17 - Punta del Este, Uruguay
Punta Dreaming by Luciano Straga #pd17 - Punta del Este, UruguayLuciano Straga
 
Spstc2011 managed metadata real world
Spstc2011 managed metadata real worldSpstc2011 managed metadata real world
Spstc2011 managed metadata real worldAtul Chhoda
 
Spstc2011 managed metadata real world
Spstc2011 managed metadata real worldSpstc2011 managed metadata real world
Spstc2011 managed metadata real worldAtul Chhoda
 
Intro to AppExchange - Building Composite Apps
Intro to AppExchange - Building Composite AppsIntro to AppExchange - Building Composite Apps
Intro to AppExchange - Building Composite Appsdreamforce2006
 
黑豹 ch4 ddd pattern practice (2)
黑豹 ch4 ddd pattern practice (2)黑豹 ch4 ddd pattern practice (2)
黑豹 ch4 ddd pattern practice (2)Fong Liou
 
Dh2 Apps Training Part2
Dh2   Apps Training Part2Dh2   Apps Training Part2
Dh2 Apps Training Part2jamram82
 
MuleSoft London Community February 2020 - MuleSoft and OData
MuleSoft London Community February 2020 - MuleSoft and ODataMuleSoft London Community February 2020 - MuleSoft and OData
MuleSoft London Community February 2020 - MuleSoft and ODataPace Integration
 
AGADOS function & feature Chapter-02 biz logic define
AGADOS function & feature Chapter-02 biz logic defineAGADOS function & feature Chapter-02 biz logic define
AGADOS function & feature Chapter-02 biz logic defineYongkyoo Park
 
D22 Portlet Development With Open Source Frameworks
D22 Portlet Development With Open Source FrameworksD22 Portlet Development With Open Source Frameworks
D22 Portlet Development With Open Source FrameworksSunil Patil
 
D22 portlet development with open source frameworks
D22 portlet development with open source frameworksD22 portlet development with open source frameworks
D22 portlet development with open source frameworksSunil Patil
 
Custom Metadata Records Deployment From Apex Code
Custom Metadata Records Deployment From Apex CodeCustom Metadata Records Deployment From Apex Code
Custom Metadata Records Deployment From Apex CodeBohdan Dovhań
 
Silverlight 5 whats new overview
Silverlight 5 whats new overviewSilverlight 5 whats new overview
Silverlight 5 whats new overviewmdc11
 
Building social and RESTful frameworks
Building social and RESTful frameworksBuilding social and RESTful frameworks
Building social and RESTful frameworksbrendonschwartz
 
Develop iOS and Android apps with SharePoint/Office 365
Develop iOS and Android apps with SharePoint/Office 365Develop iOS and Android apps with SharePoint/Office 365
Develop iOS and Android apps with SharePoint/Office 365Kashif Imran
 

Similar to Best practices in using Salesforce Metadata API (20)

Best practices in using Salesforce Metadata API
Best practices in using Salesforce Metadata APIBest practices in using Salesforce Metadata API
Best practices in using Salesforce Metadata API
 
Advanced Web Development
Advanced Web DevelopmentAdvanced Web Development
Advanced Web Development
 
Mike Taulty MIX10 Silverlight Frameworks and Patterns
Mike Taulty MIX10 Silverlight Frameworks and PatternsMike Taulty MIX10 Silverlight Frameworks and Patterns
Mike Taulty MIX10 Silverlight Frameworks and Patterns
 
Punta Dreaming by Luciano Straga #pd17 - Punta del Este, Uruguay
Punta Dreaming by Luciano Straga #pd17 - Punta del Este, UruguayPunta Dreaming by Luciano Straga #pd17 - Punta del Este, Uruguay
Punta Dreaming by Luciano Straga #pd17 - Punta del Este, Uruguay
 
J2EE pattern 5
J2EE pattern 5J2EE pattern 5
J2EE pattern 5
 
Spstc2011 managed metadata real world
Spstc2011 managed metadata real worldSpstc2011 managed metadata real world
Spstc2011 managed metadata real world
 
Spstc2011 managed metadata real world
Spstc2011 managed metadata real worldSpstc2011 managed metadata real world
Spstc2011 managed metadata real world
 
Intro to AppExchange - Building Composite Apps
Intro to AppExchange - Building Composite AppsIntro to AppExchange - Building Composite Apps
Intro to AppExchange - Building Composite Apps
 
黑豹 ch4 ddd pattern practice (2)
黑豹 ch4 ddd pattern practice (2)黑豹 ch4 ddd pattern practice (2)
黑豹 ch4 ddd pattern practice (2)
 
RubaDevi_Salesforce
RubaDevi_SalesforceRubaDevi_Salesforce
RubaDevi_Salesforce
 
Dh2 Apps Training Part2
Dh2   Apps Training Part2Dh2   Apps Training Part2
Dh2 Apps Training Part2
 
MuleSoft London Community February 2020 - MuleSoft and OData
MuleSoft London Community February 2020 - MuleSoft and ODataMuleSoft London Community February 2020 - MuleSoft and OData
MuleSoft London Community February 2020 - MuleSoft and OData
 
AGADOS function & feature Chapter-02 biz logic define
AGADOS function & feature Chapter-02 biz logic defineAGADOS function & feature Chapter-02 biz logic define
AGADOS function & feature Chapter-02 biz logic define
 
D22 Portlet Development With Open Source Frameworks
D22 Portlet Development With Open Source FrameworksD22 Portlet Development With Open Source Frameworks
D22 Portlet Development With Open Source Frameworks
 
D22 portlet development with open source frameworks
D22 portlet development with open source frameworksD22 portlet development with open source frameworks
D22 portlet development with open source frameworks
 
Custom Metadata Records Deployment From Apex Code
Custom Metadata Records Deployment From Apex CodeCustom Metadata Records Deployment From Apex Code
Custom Metadata Records Deployment From Apex Code
 
Silverlight 5 whats new overview
Silverlight 5 whats new overviewSilverlight 5 whats new overview
Silverlight 5 whats new overview
 
Building social and RESTful frameworks
Building social and RESTful frameworksBuilding social and RESTful frameworks
Building social and RESTful frameworks
 
Develop iOS and Android apps with SharePoint/Office 365
Develop iOS and Android apps with SharePoint/Office 365Develop iOS and Android apps with SharePoint/Office 365
Develop iOS and Android apps with SharePoint/Office 365
 
Salesforce connect
Salesforce connectSalesforce connect
Salesforce connect
 

Recently uploaded

Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 

Recently uploaded (20)

Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 

Best practices in using Salesforce Metadata API

  • 1. Presentation Title Date Best practices in using Salesforce Meta Data API Naveen Gabrani CEO Astrea IT Services ngabrani At astreait.com @ngabrani Copyright Salesforce 2014. Legal Terms and more here. Sanchit Dua Senior Software Developer Astrea IT Services @Sanchit1 Naveen Gabrani CEO Astrea IT Services ngabrani At astreait.com
  • 2. Presentation Title Date Copyright Salesforce 2014. Legal Terms and more here. Sanchit Dua Senior Software Developer Astrea IT Services Agenda 1. What is Metadata 2. What is Metadata API 3. How can I access it? 4. Two type of Metadata operations 5. Common applications of the Metadata API 6. Development Scenarios and correct implementation 7. Best Practices and common issues
  • 3. Presentation Title Date What is Metadata  Data: Some thing that is stored in database (accounts)  Metadata: Configuration/Code describes how the application looks  Shapes the functionality of your specific applications  Controls logic and presentation What is Metadata API  Programmable interface to access Salesforce Metadata  Allows you to review/update Metadata components  Supported from all modern languages like .Net, Java, PHP  Allows you to get/update XML version of an Org  SOAP based  Supports both Synchronous and Asynchronous invocation  Synchronous support added in Summer ’13 Copyright Salesforce 2014. Legal Terms and more here.
  • 4. Presentation Title Date Applications of Metadata API  Standard Salesforce tools written using Metadata API  Eclipse IDE  ANT Migration tool  Data loader  Standard configuration on all your customer instances  Java screens to create Salesforce objects, fields, validation rules etc  Regular backup of configuration Metadata Components Metadata components  Object and Field definitions  Visualforce pages  Page Layouts  Validation rules  Apex  Workflows  Profiles  Reports Copyright Salesforce 2014. Legal Terms and more here.
  • 5. Presentation Title Date Metadata API CRUD Operations File Based (Declarative) Copyright Salesforce 2014. Legal Terms and more here. Metadata Use this to create/update Metadata elements like Objects Use this for deploying Metadata from one Salesforce instance to another More Granular Deploy() and Retrieve() CRUD based web services  Used to create, delete, update sets of Metadata components  Create a field  Create an object  Create a page layout  Setting Field Level Security  Synchronous Methods as of v-31 (Summer ’14)  createMetadata()  deleteMetadata()  udpateMetadata()  upsertMetadata()
  • 6. Presentation Title Date create() flow User SFDC Copyright Salesforce 2014. Legal Terms and more here. AsyncResult object generated. Includes ID create(new CustomObject(“MyObject”)) Return Async Result CheckStatus(ID) = done? Return Deploy Messages CustomObject co = new CustomObject(); co.setFullName(uniqueName); co.setDeploymentStatus(DeploymentStatus.Deployed ); co.setDescription("Created by Sanchit"); co.setEnableActivities(true); co.setLabel(label); co.setPluralLabel(label + "s"); co.setSharingModel(SharingModel.ReadWrite); AsyncResult[] results = metadataConnection.create(new Metadata[] { co }); User SFDC CustomObject is <xsd: extension base=“tns:Metadata”> File based Metadata call  File-based Metadata calls  Retrieve and deploy XML representations of Metadata  Can be used to deploy Metadata from one instance to another  Requires package.xml  Specifies type of component  Specifies names of component
  • 7. Presentation Title Date A typical custom object example {File Name: CustomObject/MyObject__c} <?xml version="1.0" encoding="UTF-8"?> <CustomObject xmlns="http://soap.sforce.com/2006/04/metadata"> <deploymentStatus>Deployed</deploymentStatus> <fields> <fullName>Due_Date__c</fullName> <defaultValue>TODAY() + 3</defaultValue> <label>Due Date</label> <type>Date</type> </fields> <sharingModel>ReadWrite</sharingModel> <recordTypes> <fullName>Classification</fullName> <active>true</active> <description>Classification Records</description> <label>Classification</label> </recordTypes> <recordTypes> <fullName>Client_Code</fullName> <active>true</active> <description>Client Code Records</description> <label>Client Code</label> </recordTypes> </CustomObject> Create your Database Tables Create your Database Fields Copyright Salesforce 2014. Legal Terms and more here. Define Schema attributes Metadata API and SOAP API Metadata Data Metadata Data Metadata API Web Services API Metadata API Web Services API
  • 8. Presentation Title Date Setting up infrastructure 1. Download the latest WSC – Web Service Connector 2. From Setup->API Enterprise WSDL Metadata WSDL 3. Generate the Jar files from WSDL 4. Set the classpath of the Application. Establishing Connection 1. Use ConnectorConfig class to set end point to https://login.salesforce.com/services/Soap/c/31.0 2. Use EnterpriseConnection to specify user name and password to login 3. Initialize Metadata component – e.g CustomObject, CustomField etc. 4. Pass the Metadata component to create() / update() / delete() call. Copyright Salesforce 2014. Legal Terms and more here.
  • 9. Presentation Title Date Best Practices and common issues Development Scenarios  Setting the Page Layout  Editing the Profile  Creating Record Types Enforcing rules at runtime involves recompiling of code (with associated possibility of compile time errors). Copyright Salesforce 2014. Legal Terms and more here.
  • 10. Presentation Title Date Profile Edits Configuring a Profile:  Open a profile  Edit configurations NOTE  It’s a complex task to achieve via coding without knowing listMetadata() or Workbench.  Default Result of listMetadata() as: SolutionManager Customer Portal Manager Standard StandardAul Standard Chatter Free User Chatter External User Copyright Salesforce 2014. Legal Terms and more here. Admin Force%2Ecom - Free User MarketingProfile Custom%3A Marketing Profile HighVolumePortal Record Types Creation Generally available steps  Add a record Type  Assign it to layouts and profiles  Clicking new on the object view NOTE  This case is very easily done on declarative platform  Doing this via Metadata API is relatively complex
  • 11. Presentation Title Date Insufficient Access On Cross Reference Entity  An exception  Using Create, Update and Delete  Occurs using record type id Copyright Salesforce 2014. Legal Terms and more here. Demo
  • 12. Presentation Title Date A quirk using Ant Migration Tool  Using destructiveChanges.xml  To delete a field of type picklist we can’t delete the values instead we delete the whole field.  This is the limitation of Metadata API. Tooling API  The tooling API is designed for developing user interface tools to interact with the development artifacts in orgs.  It can be accessed via SOAP and REST.  Developer Console is largely built on the tooling API  Best used in conjunction with the Metadata API as a junction. Copyright Salesforce 2014. Legal Terms and more here.
  • 13. Presentation Title Date Recap  Metadata API gives you flexibility to manipulate Salesforce instance from outside the platform  Two types of Metadata API  CRUD based  Declarative  Application Business process code needs to mimic the user interface flow  Record Type Creations  Profile Edits  More important than ever that you define and enforce the boundaries  You should respect the intent of platform configurations and not surface data in ways that is not permitted. Resources  Metadata API Developer’s Guide  http://www.salesforce.com/us/developer/docs/api_meta  https://developer.salesforce.com/en/events/webinars/metadata-api  salesforce.stackexchange.com Copyright Salesforce 2014. Legal Terms and more here.
  • 14. Presentation Title Date Resources  Metadata API Developer’s Guide  http://www.salesforce.com/us/developer/docs/api_meta  https://developer.salesforce.com/en/events/webinars/metadata-api  salesforce.stackexchange.com  https://github.com/sanchitdua/md_java_asynchronous  https://github.com/sanchitdua/md_java_synchronous Copyright Salesforce 2014. Legal Terms and more here. Q&A
  • 15. Presentation Title Date Copyright Salesforce 2014. Legal Terms and more here.