Manage Salesforce metadata with a package.xml manifest and Salesforce CLI.
Deploying and updating metadata components is part of creating apps on the Salesforce Platform.
Metadata -
Metadata are the assets in your org (assets being objects, tabs, classes, etc). These metadata assets are also called metadata components.
Metadata Components -
Metadata types are the general classification for metadata components. For example, CustomObject is a metadata type for standard and custom objects. In the example below, the MyCustomObject__c custom object (a metadata component) is an instance of the CustomObject metadata type.
Metadata Tools -
Salesforce has a variety of tools you can use to work with the metadata in your org, such as change sets or the Salesforce command-line interface (CLI). When you’re deploying metadata, each of these tools serves a purpose and is very useful, depending on what you are aiming to accomplish. Package.xml is just another handy-dandy tool in your toolbox.
Package.xml is also useful if you are creating an unmanaged package, or if you want to grab only specific metadata components to deploy.
Change Sets -
Change sets is one of the tools provided by Salesforce for migrating metadata changes between orgs. It provides a process to synchronize the metadata between a source org and a target org.
Change sets are supported by Enterprise and Unlimited Edition environments. It's a point and click tool which does not require installation of specific software and does not require the downloading and uploading of files. Certain levels of dependencies are analyzed and cloning change sets is a helpful way to iteratively build packages within a project.
Salesforce CLI -
Salesforce includes a command-line interface (CLI) that simplifies development and build automation when working with your Salesforce org. Use it to create and manage orgs, synchronize source to and from orgs, create and install packages, and more. It allows you to interact with your Salesforce environments in many ways, like retrieving or pushing code or interacting with data. The CLI consists of several plugins. These plugins provide important specific functionality. For example, the salesforcedx plugin provides the ability to interact with Salesforce orgs and their data.
Use the Salesforce command-line interface to create, convert, and deploy apps.
The Salesforce CLI provides a quick way to run operations for creating and configuring scratch orgs, and also for deploying components.
Salesforce CLI is a bundle of two executables: sf and sfdx. We first launched sfdx to provide you with the ability to develop and test your apps more easily on Salesforce Platform. But if you want to work across all Salesforce clouds, sfdx doesn’t provide all the commands you need. With sf, we're bringing together a cross-cloud set of commands that streamline how you build and deploy across Salesforce.
To verify Salesforce CLI installation, run this command -
sfdx --version
sfdx-cli/7.144.0 darwin-x64 node-v16.14.2
NOTE: SFDX is a command line utility for managing salesforce builds/ deployments.
Ensure you are using latest version by running the following command from the command line in Adminstrator mode.
sfdx update
You should see output like sfdx-cli: Updating CLI....
What is Ant?
The Ant migration tool is a free tool provided by Salesforce. It is a Java/Ant based command line utility for moving metadata between a local folder and an org. It's also known as the Force.com migration tool.
Visual Studio Code -
is a free, streamlined code editor that offers unlimited customization through tens of thousands of commercial and community extensions. These extensions add support for virtually any language, platform, and DevOps service.
It is free, open-source, and powerful editor that is highly customizable and cross-platform. Developers can be productive on Windows, Mac, or Linux. Visual Studio Code is the ideal option for developers who can't use Visual Studio. Salesforce Extensions for Visual Studio Code is the successor to the Force.com IDE plug-in for Salesforce development on the desktop.
Visual Studio Code is the go-to code and well-established IDE among web developers. Now it’s also an effective IDE for building Lightning web components, and Salesforce provides free extensions for Visual Studio Code that simplify your development experience even more.
The Salesforce Extension Pack for Visual Studio Code provides code-hinting, lint warnings, and built-in commands: click here.
Git -
Most teams opt to use Git, the most popular version control system, to manage their code.
Visual Studio -
is a full-featured integrated development environment (IDE). If you can use it, Visual Studio is ideal for working in Windows to build software for various platforms, including .NET or .NET Core, iOS, Android via Xamarin, and targets that support C++.
Visual Studio historically offers DevOps productivity and integration benefits. Visual Studio natively integrates with GitHub and Azure DevOps, and has a robust ecosystem of extensions for every industry DevOps provider.
Additional Ref:
Salesforce DX -
Salesforce Developer Experience (DX) is a set of tools that streamlines the entire development life cycle. It improves team development and collaboration, facilitates automated testing and continuous integration, and makes the release cycle more efficient and agile.
It shifts your development focus from org development to package development.
Dev Hub and Scratch Orgs -
A scratch org is a dedicated, configurable, and short-term Salesforce environment that you can quickly spin up when starting a new project, a new feature branch, or a feature test. Scratch orgs aren’t meant to be replications of sandboxes or production orgs. Sandboxes, which contain all the metadata of your production org, are still necessary for final user-acceptance testing, continuous delivery, and staging.
Scratch orgs are disposable Salesforce orgs to support development and testing. Dev Hub is a feature that manages your scratch orgs. Both are part of the Salesforce DX tool set.
Many of the Salesforce DX tools enable you to use a scratch org. Scratch orgs drive developer productivity and collaboration during the development process, and facilitate automated testing and continuous integration. You can use the CLI or Salesforce Extensions for VS Code to open your scratch org in a browser without logging in.
A Developer Hub (Dev Hub) is the main Salesforce org that you and your team use to create and manage your scratch orgs.
Version Control System: GitHub -
Recommend GitHub to take advantage of the samples in our GitHub repository.
We share extensions, samples, and more through GitHub repos. Get a GitHub account to make sure you can take advantage of these offerings.
Lightning Component Library -
The reference for both Aura and Lightning web components and how to use them is found here. You can view the library through your org's instance, too, at http://
Lightning Web Components Recipes -
We provide a GitHub repo to help you see how Lightning web components work. You can clone, tinker, and publish this mix of samples to your own scratch org and see them in action. Get it here.
E-Bikes Demo -
This GitHub repo is another great way to see how Lightning web components work. The e-bikes demo is an end-to-end implementation of Lightning web components to create an app. Try this example in your own scratch org. Get it at https://github.com/trailheadapps/ebikes-lwc.
Lightning Data Service (LDS) -
Access data and metadata from Salesforce via Lightning Data Service. Base Lightning components that work with data are built on LDS. Customize your own components to take advantage of LDS caching, change-tracking, performance, and more.
Lightning Locker -
Lightning web components that belong to one namespace are secure from components in a different namespace through Security with Lightning Locker. Lightning Locker also promotes best practices that improve the supportability of your code by only allowing access to supported APIs and eliminating access to nonpublished framework internals.
Node.js
We bundle Node.js in each operating system-specific Salesforce CLI installer. We include the version of Node.js with Active LTS status and update it in tandem with the Node.js release schedule.
Additional Ref:
A DevOps development environment should not only edit and debug code, but integrate with the rest of the DevOps cycle, including testing, version control, and production monitoring. Microsoft provides two major development environments to support DevOps, Visual Studio and Visual Studio Code.
Additional Ref:
??
API is equivalent to a user interface, except it’s designed for software instead of humans. This is why APIs are often described in the media as technology that allows applications to talk to one another.
The client sends a request for specific information or functionality to another system. That system returns the data or functionality in a response.
REST API -
REST callouts are based on HTTP. Each callout request is associated with an HTTP method and an endpoint. The HTTP method indicates what type of action is desired.
The simplest request is a GET request (GET is an HTTP method). A GET request means that the sender wants to obtain information about a resource from the server. When the server receives and processes this request, it returns the request information to the recipient. A GET request is similar to navigating to an address in the browser. When you visit a web page, the browser performs a GET request behind the scenes. In the browser, the result of the navigation is a new HTML page that’s displayed. With a callout, the result is the response object.
Common HTTP Methods -
GET - Retrieve data identified by a URL.
POST - Create a resource or post data to the server.
DELETE - Delete a resource identified by a URL.
PUT - Create or replace the resource sent in the request body.
In addition to the HTTP method, each request sets a URI, which is the endpoint address at which the service is located.
In addition to the endpoint and the HTTP method, you can set other properties for a request. For example, a request can contain headers that provide more information about the request, such as the content type. A request can also contain data to be sent to the service, such as for POST requests.
If the service sends the response in JSON format. JSON is essentially a string, so the built-in JSONParser class converts it to an object.
Send Data to a Service -
Another common use case for HTTP callouts is sending data to a service. Example sends a POST request to the web service to add an animal name. The new name is added to the request body as a JSON string.
Trailhead - Create Lightning Web Components
SOAP API -
WSDL2Apex automatically generates Apex classes from a WSDL document. You download the web service's WSDL file, and then you upload the WSDL and WSDL2Apex generates the Apex classes for you. The Apex classes construct the SOAP XML, transmit the data, and parse the response XML into Apex objects. Instead of developing the logic to construct and parse the XML of the web service messages, let the Apex classes generated by WSDL2Apex internally handle all that overhead. If you are familiar with WSDL2Java or with importing a WSDL as a Web Reference in .NET, this functionality is similar to WSDL2Apex.
Generate an Apex Class from the WSDL -
From Setup, enter Apex Classes in the Quick Find box, then click Apex Classes.
Click Generate from WSDL.
Click Choose File and select the downloaded calculator.wsdl file.
Click Parse WSDL.
The application generates a default class name for each namespace in the WSDL document and reports any errors.
Click Generate Apex code.
The generated Apex classes include stub and type classes for calling the third-party web service represented by the WSDL document. These classes allow you to call the external web service from Apex.
Expose Your Apex Class as a Web Service -
You can expose your Apex class methods as a REST or SOAP web service operation. By making your methods callable through the web, your external applications can integrate with Salesforce to perform all sorts of nifty operations.
Expose a Class as a REST Service -
To make Apex class available as a REST web service, define your class as global, and define methods as global static. Add annotations to the class and methods. For example, Apex REST class uses one method - getRecord is a custom REST API call. It's annotated with @HttpGet and is invoked for a GET request.
The URL mapping is case-sensitive and can contain a wildcard character (*).
Expose a Class as a SOAP Service -
Making your Apex class available as a SOAP web service is as easy as with REST. Define your class as global. Add the webservice keyword and the static definition modifier to each method you want to expose. The webservice keyword provides global access to the method it is added to.
Apex REST supports two formats for representations of resources: JSON and XML. JSON representations are passed by default in the body of a request or response, and the format is indicated by the Content-Type property in the HTTP header. Since JSON is easier to read and understand than XML, this unit uses JSON exclusively. In this step, you send a case record in JSON format.
Apex REST supports OAuth 2.0 and session authentication mechanisms.
??
Refer to the additional references and respurces below for the exam preparations.