You need to sign in to do that
Don't have an account?
IceEngine
[Field References] How to get Field referenced by List ?
Hi, as everyone knows when to delete a custom field, salesforce check the referenced source, such as Visualforce page, Apex class.
For example, if you want to delete [custom__c] field in an object, a deleteredirect.jsp page will show a list that [custom__c] field has been referenced by, so that you couldn't delete it.
My problem is, I want to get the Referenced by List of all the fields in my Schema, but to delete all the fields one by one Manually is not a good way.
So is there a good solution?
Any help would be much appreciated!
IceEngine,
There is no out-of-the-box solution for what you want to do.
However, you can use the Metadata API to create a utility which would do this functionality.
The Metadata API allows you to download (almost) all of your Force.com configuration (Object & Fields, Layouts, Visualforce PAges, Apex Triggers, Apex Classes, Workflows, ETC) as XML files.
By using the Metadata API, you could build a tool that downloads your metadata as a set of XML files, does a REGEX or Scan against all the XML files for the Field Names (API Field Names), and generates a list of the referenced Objects, Pages, Apex, ETC.
Into to Metadata API
http://wiki.developerforce.com/page/An_Introduction_to_Force.com_Metadata
http://www.salesforce.com/us/developer/docs/api_meta/
Sample Application Using Metadata API
http://wiki.developerforce.com/page/Metadata_Mashup_%E2%80%93_Exporting_MySQL_Schemas_to_Force.com
Hope that helps
All Answers
IceEngine,
There is no out-of-the-box solution for what you want to do.
However, you can use the Metadata API to create a utility which would do this functionality.
The Metadata API allows you to download (almost) all of your Force.com configuration (Object & Fields, Layouts, Visualforce PAges, Apex Triggers, Apex Classes, Workflows, ETC) as XML files.
By using the Metadata API, you could build a tool that downloads your metadata as a set of XML files, does a REGEX or Scan against all the XML files for the Field Names (API Field Names), and generates a list of the referenced Objects, Pages, Apex, ETC.
Into to Metadata API
http://wiki.developerforce.com/page/An_Introduction_to_Force.com_Metadata
http://www.salesforce.com/us/developer/docs/api_meta/
Sample Application Using Metadata API
http://wiki.developerforce.com/page/Metadata_Mashup_%E2%80%93_Exporting_MySQL_Schemas_to_Force.com
Hope that helps
Also using the Metadata API you could build a process to update those files too (I.E. En Masse Commeent out the references, save the metadata, delete the fields)
Keep in mind that returning fields in Apex and VF is not 100% accurate, as a field with the same API name on different objects would return as being found in a class, even though it might not (as others have mentioned).
Also, it can take quite a while to run on large Orgs.
App: http://schemalister.herokuapp.com/
Source Code: https://github.com/benedwards44/schemalister