What is Salesforce Workbench?

Nov. 10, 2022 ยท 6 minutes

Administrators and developers can communicate with Salesforce.com organizations by using the Force.com APIs by using Workbench, a robust web-based toolkit. Users of Workbench can 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. Workbench includes robust support for the Force.com Partner, Bulk, Rest, Streaming, Metadata, and Apex APIs. For testing and troubleshooting the Force.com APIs, Workbench also offers a wealth of sophisticated features, including customized SOAP headers, debug logs for API traffic, backward compatibility testing with earlier API versions, and single sign-on integration within the Salesforce platform.

Workbench 25.0.1 adds background processing for lengthy processes, enabling queries and scripts to execute completely without causing a page to load slowly. Information about asynchronous background processing is provided below. More secure sessions, support for Force.com Canvas signed requests, OAuth CSRF protection, and a partial upgrade to Force.com API 26.0 are other improvements.

What is the purpose of Workbench? 

Workbench is a tool that application administrators and developers can use to quickly view the data and metadata of their organizations, test and troubleshoot their own applications, and be a one-stop shop for interacting with the various Force.com APIs. It is designed to function just like a real workbench.

Additionally, it is intended to support the user just enough so that they can accomplish these objectives without getting in the way or having to do too much thinking for them. This is crucial to remember when using Workbench to test and troubleshoot APIs since it gives you the ability to take charge and carry out actions that are typically not feasible through most API clients. As a result, Workbench does not interpret or otherwise alter the majority of error signals from the APIs before returning them to the user.

Workbench

What purposes does Workbench not serve? 

Due to its web-based nature, Workbench is susceptible to browser and connection timeouts; however, if you have access, you can change these in PHP's settings. Therefore, it is not advised to use Workbench for demanding tasks such as scripting, massive data loading, or exporting. For rapid, on-the-spot interactions with the APIs, it is considerably better suited.

What login methods does Workbench support?

Both OAuth 2.0 remote access login and session id login are supported by Workbench. Additionally, Workbench Tools for Firefox is a browser add-on that allows you to quickly go from the Salesforce user interface to Workbench. Details on these login procedures are provided below.

How do you switch API versions without exiting Workbench?

You can access the User Session Information page with a dropdown menu of the available API versions by selecting the user information link in the upper-right corner below the navigation bar. Your user session will be modified after you select the desired API version. Your user session will immediately revert to the earlier version if you select an unsupported API version.

How can you use Salesforce's Workbench in a Web Tab for single sign-on?

If the Login CSRF, conditions agreement, or OAuth login are necessary, this functionality cannot be used for authentication. This includes the workbench.developerforce.com demo site.

Users can automatically log into Workbench by entering their Server URL and Session Id in the URL parameters thanks to an API that Workbench has made available. For single sign-on to Workbench, this can involve integrating Workbench into a Web Tab that is already open in Salesforce. Follow the steps listed below to integrate Workbench into your organization:

  1. Login to Salesforce 
  2. Setup | Create | Tabs | Web Tabs | New 
  3. Choose Tab Layout
  4. Set Up the Display and Content Properties
  5. Button or Link URL 
  6. Save

Do you have to export a CSV if I only want to change one record?

Currently not. In query or search results, Workbench 22.0.1 allows you to examine and update individual records by just clicking on their id. You can go directly to the operation you wish to run on the Data menu and paste the id into the Single Record field if you already know the id or it originated from somewhere else than Workbench.

Salesforce and Workbench

In some data management processes, a ZIP file may also be uploaded. What's the purpose of that, and what format should the ZIP file be in? When importing, editing, upserting, or removing binary files like Content, Documents, or Attachments using Workbench, you can upload a ZIP file. Prepare a ZIP file containing the binary files and the "request.txt" manifest file in order to use this feature. For further details on producing the ZIP file, go to the Salesforce.com Bulk API Guide. For ZIP files without binary files, take note that you can use the functionality, but you won't be able to map the fields in Workbench, therefore make sure all the fields in the manifest correspond to those in Salesforce.

Is queryAll() supported by Workbench?

Yes. The query() API call, which is what the Query function by default uses, excludes deleted and archived records from your organization. Go to Query and choose "Include" for the "Deleted and archived records" option to retrieve deleted and archived records with the queryAll() API call.

If the "Automatically Retrieve More Query Results" option is activated in Settings or when exporting to a CSV file, the Query function takes care of this for you automatically. When more records than your default batch size are returned, a "More..." button will show at the top and bottom of your query results if you opt to leave this setting off. To get more results, just click one of these options. The "Preferred Query Batch Size" item in the Settings menu allows you to choose the query batch size. Please be aware that working with huge batch sizes or retrieving large amounts of data automatically may cause browser timeouts and Workbench to hang. Restart your browser and try again with a reduced batch size if this is the case.

How can you use Workbench to describe and list different metadata kinds and components? 

The Metadata Types & Components page defines and lists the metadata types and components of the logged organization by combining the power of the describeMetadata() and listMetadata() Metadata API functions. By clicking the INFO links included within the Type Description folder, you can switch between parent and child metadata types.

How does Workbench extract metadata elements from a Salesforce organization? 

Sending a retrieve call to the Force.com Metadata API allows Workbench to retrieve both packaged and unpackaged metadata components. The Force.com Metadata API then asynchronously processes the request on the Salesforce servers. When the server-side processing is finished, you can download the results and keep track of the retrieval's progress in Workbench.

Simply enter a list of package names, separated by commas, on the Obtain page to retrieve packed metadata. You must upload an unpackaged manifest file (i.e., "package.xml") in order to obtain unpackaged metadata.

What is CSRF, and how should I set up Workbench's CSRF protection?

Cross-Site Request Forgery, or CSRF, refers to an attack where hackers persuade users to enter or modify data on their behalf through a web site the user trusts. Workbench includes CSRF protection, which depends on a "secret" kept on your Workbench instance, to defend itself and your data from these kinds of assaults. It is strongly advised that you update the default secret to a secret that only you know. Change the default "CHANGE ME" and uncomment the line by deleting the leading double backslashes from your config/overrides.php file's "CSRF SECURITY SETTINGS" section.

You can set Login CSRF Protection in addition to Workbench's regular CSRF protection to prevent programmed logins that might be exploited in an attack. Be aware that if Login CSRF Protection is turned on, even safe programmatic logins from sources like Workbench Tools for Firefox would be prevented. Add the following line to your config/overrides.php file to activate Login CSRF Protection:

$config\["loginCsrfEnabled"\]\["default"\]=true;