function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Shazib MahmoodShazib Mahmood 

TryDelete / GetReference function

Hi,

I am looking for a function in any of the APIs (Probably Metadata API), that could help me get references on a field. E.g used in apex, another field etc.

Just like the way when you try to delete a field and it gives you the reference list.

Thanks
Anup JadhavAnup Jadhav
You should be able to do this with the Tooling API instead of the metadata api. According to the docs (https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/):
 
When to Use Tooling API
Tooling API facilitates the development of any organization-based user interface or user experience that requires create, read, update, or delete operations to Salesforce metadata. By contrast, Metadata API facilitates the migration of Salesforce metadata from one organization to another.

Checkout the custom field documentation (https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_customfield.htm).

Anup