You need to sign in to do that
Don't have an account?
Vishal Negandhi 16
Fetching all references to a field in the environment - Tooling/Metadata API
Hello folks,
Today we were trying to work on a utility that will list out all references to a field. This is intented to help the business to analyze a field before they plan to update/delete it.
What we are trying to achieve?
- Once the user selects an object and one of its fields, we want to list out all possible components where the selected field is referenced.
What were we able to achieve, using what?
- We first tried the Standard SOQL approach and queried objects such as ApexClass, ApexComponent, ApexPage and ApexTrigger : this helped us to find out references of a field in the code by scanning their body/markup.
- We then thought of utilizing the Tooling API that has a SOSL feature, using which we were able to retreive all the codes where the field was referenced.
Code snippet:
/services/data/v34.0/tooling/search/?q=FIND{BillingCity}
This gives me a list of all code where there is "BillingCity" referred.
However, none of the approaches has helped us to touch other components such as:
- formula field
- report filters
- workflow field updates
Wanted to understand how do we get around this?
I know this is possible using Tooling API but then if I end up making one http callout for each component then I am going to make a lot of callouts.
Is there something I am missing here?
Need some guidance around this.
Many thanks in advance!
Today we were trying to work on a utility that will list out all references to a field. This is intented to help the business to analyze a field before they plan to update/delete it.
What we are trying to achieve?
- Once the user selects an object and one of its fields, we want to list out all possible components where the selected field is referenced.
What were we able to achieve, using what?
- We first tried the Standard SOQL approach and queried objects such as ApexClass, ApexComponent, ApexPage and ApexTrigger : this helped us to find out references of a field in the code by scanning their body/markup.
- We then thought of utilizing the Tooling API that has a SOSL feature, using which we were able to retreive all the codes where the field was referenced.
Code snippet:
/services/data/v34.0/tooling/search/?q=FIND{BillingCity}
This gives me a list of all code where there is "BillingCity" referred.
However, none of the approaches has helped us to touch other components such as:
- formula field
- report filters
- workflow field updates
Wanted to understand how do we get around this?
I know this is possible using Tooling API but then if I end up making one http callout for each component then I am going to make a lot of callouts.
Is there something I am missing here?
Need some guidance around this.
Many thanks in advance!
You may find that pulling down everything via ANT to disk an search through that.