Last Updated on March 31, 2022 by Rakesh Gupta
Big Idea or Enduring Question:
- How to find newly created or modified fields in Salesforce?
Objectives:
After reading this blog, you’ll be able to:
- Understand Tooling API objects – CustomField and CustomObject
- Query Tooling API objects from Developer Console
- Find out newly created or modified custom fields
- Find out newly created or modified custom objects
Business Use case
Anita Smith is working as a Salesforce Consultant at Gurukul On Cloud (GoC). She has received a requirement from her Architect to find out custom fields and objects created in the last 365 days.
Understand CustomObject and CustomField Tooling API Objects
While working on a cleanup project we often have a requirement to find out custom fields and custom objects created in the last n days. There are various ways to achieve it, for example:
- Object Manager
- Setup Audit Trail
We will use Tooling API objects to find out such details. It is very simple, just run a query, if needed you can able to export it.
Let’s take a pause here, familiarize yourself with the CustomObject and CustomField Tooling API objects. It contains
Object Name |
Details |
CustomObject | It represents a custom object that stores data unique to your organization. Includes access to the associated CustomObject object and related fields in Salesforce Metadata API. |
CustomField | It represents a custom field on a custom object that stores data unique to your organization. Includes access to the associated CustomField object and related fields in Salesforce Metadata API. |
Let’s begin the process.
Guided Practice (We-do): Find Newly Created Objects
To find the Custom object created in the last 365 days, we will use the Developer Console to Query the Tooling API object CustomObject.
- Click Setup | Developer Console
- In the Query Editor, enter the following SOQL query
- If you want to download the data to share with the project manager or Architect, then consider using Visual Studio Code.
Guided Practice (We-do): Find Newly Created Fields
To find the Custom fields created in the last 365 days, we will use the Developer Console to Query the Tooling API object CustomField.
- Click Setup | Developer Console
- In the Query Editor, enter the following SOQL query
- If you want to download the data to share with the project manager or Architect, then consider using Visual Studio Code.
Formative Assessment:
I want to hear from you!
What is one thing you learned from this post? How do you envision applying this new knowledge in the real world? Feel free to share in the comments below.
Thanks Rakesh, but using this query below the “DeveloperName” returns the field name column? I need both the field name AND the table name it comes from? : SELECT DeveloperName, TableEnumOrId FROM CustomField
WHERE CreatedDate = LAST_WEEK or CreatedDate = THIS_WEEK
This is great but for custom objects it only returns the long ID of the object (TableEnumOrId)
– How do I get the actual text name of the custom object in the same query?
DeveloperName will return custom object DeveloperName