Nov 23, 2023
1. Introduction
2. What is Tooling API ?
3. Authentication
4. Create a custom field on sobject
5. Update custom field on sobject
6. Create Record Type for Standard Object
7. Create Record Type for Custom Object
8. Update Record Type for Standard Object
9. Update Record Type for Custom object
10. Get all the Page Layout Name
Welcome to the world of the Tooling API – where efficiency meets innovation, and every line of code becomes a pathway to enhanced success.
In this Salesforce blog, where we embark on a journey into the heart of Salesforce development, armed with a powerful ally – the Tooling API. In the dynamic realm of application development, efficiency, and precision are paramount, and the Tooling API stands as the beacon guiding developers and administrators toward streamlined workflows and enhanced capabilities.
The Salesforce Tooling API is not just an interface; it's a dynamic toolkit designed to empower developers with programmatic access to a treasure trove of metadata, code, and development-related insights. As we delve into this RESTful web service, we'll uncover its multifaceted capabilities and explore how it transforms the development lifecycle within the Salesforce ecosystem.
Our blog will be your companion as we journey through the fundamental features of the Tooling API. Whether you're a seasoned developer, an aspiring administrator, or someone keen on exploring the depths of Salesforce capabilities, our blog is your gateway to unlocking the power of precision in Salesforce development.
The Salesforce Tooling API stands as a dynamic cornerstone in the toolkit of developers and administrators, offering a robust and versatile set of capabilities to streamline the development lifecycle within the Salesforce ecosystem. Tooling API simplifies the interaction with Salesforce metadata, allowing developers to seamlessly retrieve information about Apex classes, triggers, Visualforce pages, and a myriad of other components that constitute the building blocks of a Salesforce application. This programmatic access not only facilitates code analysis but also supports crucial tasks such as debugging, testing, and deployment.
The Tooling API is a valuable tool for developers working on the Salesforce platform, providing a programmatic interface for tasks related to development, testing, and debugging. It enhances the efficiency of development processes and supports automation in various aspects of Salesforce application development.
Before diving into Tooling API calls, it's crucial to understand the authentication process. Salesforce uses OAuth 2.0 for authentication, ensuring secure access to your org's metadata. Developers need to obtain a valid access token through the OAuth flow to make authorized requests to the Tooling API.
Get the access token in postman using this link: Get Access Token in Postman
Request Type: POST
URL: baseUrl/services/data/v56.0/tooling/sobjects/CustomField/
Request Body:
{
Response:
Request Type: PATCH
URL: baseUrl/services/data/v58.0/tooling/sobjects/CustomField/:CustomFieldId
(Make sure you have replaced :CustomFieldId with the your salesforce object's custom field Id)
Request Body:
{
Response:
If the Status Code is 204 No Content, this means the field is successfully updated.
Request Type: POST
URL: baseUrl/services/data/v58.0/tooling/sobjects/RecordType
Request Body:
Response:
Request Type: POST
URL: baseUrl/services/data/v58.0/tooling/sobjects/RecordType
Request Body:
Response:
Request Type: PATCH
URL: baseUrl/services/data/v58.0/tooling/sobjects/RecordType/:RecordTypeId
(Make sure you have replaced :RecordTypeId with the your record type Id)
Request Body:
Response:
If the Status Code is 204 No Content, this means the record type is successfully updated.
Request Type: PATCH
URL: baseUrl/services/data/v58.0/tooling/sobjects/RecordType/:RecordTypeId
(Make sure you have replaced :RecordTypeId with the your record type Id)
Request Body:
Response:
If the Status Code is 204 No Content, this means the record type is successfully updated.
Request Type: GET
URL: baseUrl/services/data/v33.0/tooling/query/?q=Select+id,name,createdDate,fullName+from+Layout+where+EntityDefinitionId=:sObjectId
(Make sure you have replaced :sObjectId with the salesforce object's Id)
Response:
I hope this blog helped you!