This post is a part of the daily blog series
A Tip A Day, daily dosage of learning!
Day #39 – Easily Find Newly Created Fields
Finding the CreatedDate of fields in Lightning Experience is hard work. The fields list in object manager doesn’t have a column for ‘Created Date’. You need to manually click each and every field to know what’s the created date.
Good luck if you want to find what new fields were created this week or this month or even this quarter.
If you don’t want to go through that manual clicking process, then you are at right place. Here’s a quick and easier way to find the list of newly created fields.
Open your Developer Console, click on the Query Editor tab, click the “Use Tooling API” checkbox, then copy the below query!
Here’s the basic query to start with. Fields created TODAY:
SELECT DeveloperName, TableEnumOrId FROM CustomField
WHERE CreatedDate = TODAY
And the result show the custom fields:
- DeveloperName is the field name.
TableEnumOrId
is the ObjectName/ ObjectId.- For standard objects, the
TableEnumOrId
gives the Name of the object directly like Account, Contact, Opportunity etc. - For custom objects, it gives the Object ID.
- For standard objects, the
If you want to fetch from a single object, you can also filter by TableEnumOrId:
Standard Object
SELECT DeveloperName, TableEnumOrId FROM CustomField
WHERE CreatedDate = TODAY AND TableEnumOrId = 'Account'
Custom Object
SELECT DeveloperName, TableEnumOrId FROM CustomField
WHERE CreatedDate = TODAY AND TableEnumOrId = '01I...'
WHere 01I… is the Id of the custom object, which you can get from the following query or if you open the Object in Object Manager in Salesforce, you’ll see the ID in the URL:
SELECT Id, DeveloperName FROM CustomObject
WHERE DeveloperName = 'CustomObj'
Note that DeveloperName in the Tooling API never uses __c.
You may also use different filters in the WHERE condition like last_week, last_month, last_quarter, last_year etc.
Tried you tip and got the following error message
DeveloperName, TableEnumOrId FROM CustomField
^
ERROR at Row:1:Column:42
sObject type ‘CustomField’ is not supported. If you are attempting to use a custom object, be sure to append the ‘__c’ after the entity name. Please reference your WSDL or the describe call for the appropriate names.
LikeLiked by 1 person
You need to select the checkbox “Use Tooling API” in the Developer console ‘Query Editor’ tab. Otherwise, it will give an error. I did mention this. Added the screenshot now.
LikeLike