Are you tired of switching between multiple tools and platforms to manage your Salesforce organization? Do you struggle to keep up with the constantly evolving needs of your clients and stakeholders? If so, it's time to discover the power of Salesforce Workbench.
Salesforce Workbench is a web-based suite of tools designed specifically for administrators and developers to interact with Salesforce organizations via the Force.com APIs. In this article, we will explore what Salesforce Workbench is and the numerous benefits you can gain by using it. From streamlined processes to increased efficiency, the advantages of Salesforce Workbench are numerous. So, if you're ready to take your Salesforce game to the next level, keep reading to find out how Workbench can help.
What is Salesforce Workbench?
Ryan Brainard, a Principal Software Engineer at Salesforce.com and the creator of Workbench has to say about it:
Workbench is a powerful, web-based suite of tools designed for administrators and developers to interact with Salesforce.com organizations via the Force.com APIs.
Ok, so you can work with a Salesforce organization all through the APIs. That's pretty cool! What else?
Workbench includes robust support for the Force.com Partner, Bulk, Rest, Streaming, Metadata, and Apex APIs that allows users to describe, query, manipulate, and migrate both data and metadata in Salesforce.com organizations directly in their web browser with a simple and intuitive user interface.
Something to call out: you can execute Apex code in the Apex Execute Anonymous window.
Workbench also provides many advanced features for testing and troubleshooting the Force.com APIs, such as customizable SOAP headers, debug logs for API traffic, backward compatibility testing with previous API versions, and single sign-on integration within the Salesforce application.
Okay, well how do we use Workbench?
How to go to Workbench
Go to https://workbench.developerforce.com. There, you'll be presented with the screen below.
It is worth noting that Workbench is not an official Salesforce.com product. If you call Salesforce Support and say Workbench is not working, they won't help you.
Environment
You can choose "Production" or "Sandbox."
API Version
Unless you're testing a specific Salesforce API version, select whatever the default version is.
Then, click Login with Salesforce. If it's your first time using Workbench, you'll see a prompt asking you to give Workbench access to your Salesforce instance via APIs.
Once you hit "Allow," you will have the ability to query your organization's data.
Mass delete records in Workbench
A great use case for Workbench is to bulk delete records in Salesforce.
Navigating to Delete
When in Workbench, click "Data" then click "Delete."
Workbench will take you to the Delete page, where you can either decide to delete a Single Record or several records from a file.
How many records do you want to delete?
If you decide to delete records from a CSV file, then the records you want to delete must contain an id. There's no other way for Salesforce to identify what you want to delete without an id.
Here's Workbench's instructions for deletes:
Select a CSV or ZIP file containing records to delete, or provide an id to delete a single record. Zipped requests must contain a CSV or XML-formatted manifest called request.txt, which may reference included binary files.
Confirm the field mapping
If you decide to upload a CSV file, the next screen you'll see will look like the screenshot below. Since my CSV file only contained Salesforce Record Ids, the mapping is trivial.
You'll also notice there are two checkbox options: Permanently hard delete records and Process records asynchronously via Bulk API. What do they mean?
Permanently hard delete records: Records aren't stored in the Recycle Bin
When specified, the deleted records are not stored in the Recycle Bin. Instead, the records become immediately eligible for deletion, don't count towards the storage space used by your organization, and may improve performance. don't count toward the storage space used by your organization, and may improve performance. The Administrative permission for this operation, 'Bulk API Hard Delete', is disabled by default and must be enabled by an administrator. A Salesforce user license is required for hard delete. Hard Delete is only available via Bulk API.
Process records asynchronously via Bulk API: Check this when you're dealing with large data volumes
Processing records synchronously is recommended for large data loads. The data will be uploaded to Salesforce via the Bulk API in batches and processed when server resources are available. After batches have completed, results can be downloaded. Batch size and concurrency options are available in Settings.
Use Workbench to Retrieve Metadata about your Salesforce org
If you want to retrieve metadata about your Salesforce org, you can do so via Workbench. All you have to do is go to the Migration tab, then click Retrieve.
Then, you'll see the Retrieve page.
The Retrieve Page
If you want to to test retrieving metadata from your Salesforce organization, make a new file and call it package.xml. Then, click Single Package and hit the Next button.
Don't know about how to build up a package.xml file? Go to this Trailhead module, which will teach you how to write one.
Look at an example Package.xml file
If you just want to test out how Retrieve works, then copy and paste the contents of the code snippet here into the newly created package.xml file.
Staging the Retrieve request
Once the request has been successfully staged, click the "Retrieve" button to retrieve the metadata you specified in the package.xml file.
You'll then be presented with the Metadata API Process Status page, which will show that your retrieval is in progress.
Depending on how much metadata you want to pull, it'll take from several seconds to several minutes to retrieve.
Once Salesforce has finished retrieving metadata you specified, you will see that the Status of your Retrieval will be "Succeeded."
Make sure you click Download ZIP File if you want to download the contents of your org's metadata. Open the ZIP file and view the contents of your metadata retrieval in the IDE of your choice.
Data management capabilities in Workbench
From a data management perspective, you can insert, update, upsert, delete, undelete, purge Salesforce data in Workbench.
Salesforce Object Query Language (SOQL queries)
One cool thing you can do in Workbench is to execute SOQL queries. You can get to to the page by going to Queries, then clicking SOQL Query.
View As:
List
List will show the results in a table view.
Matrix
SOQL Matrix view is a powerful way to group query results into rows and columns, similar to a matrix report in Salesforce, but with the power of SOQL.
Bulk CSV
When selected, it will return your SOQL query results as a CSV file. Once the query has finished running, you can export data as a CSV.
Bulk XML
It will return the SOQL query results as an XML file.
Query
Once you hit "Query," Workbench will execute a SOQL query against the Salesforce instance you're logged into. It doesn't matter if you're dealing with standard or custom objects.
Salesforce Object Search Language (SOSL queries)
Navigating to SOSL Search
Click "Queries". Then, click "SOSL Search."
Like in the SOQL query section, you can filter results based on the Objects and fields you want to return.
If you want to play around with a SOSL query, but can't think of one of the top of your head, then copy & paste the one below.
FIND {Gen} IN ALL Fields RETURNING Account (Id, Name), Case(Subject)LIMIT 100