1

How can I find if a custom field(Sobject, Custom Setting/Metadata) exist in org using apex? I might have its partial name or similar sub string.

4
  • What do you mean by a partial name or sub string? How are you intending to use that to identify a field?
    – David Reed
    Commented Nov 1, 2019 at 0:05
  • It looks like you are looking for a Dynamic Search, but... why do you want to have something like that? It is part of a requirement? Commented Nov 1, 2019 at 0:05
  • @David, If field name is "Total Price", Then I shall be able to find field if I input "Total" or "Price"@Carlos, this is not part of requirement but something helpful while working Commented Nov 1, 2019 at 0:08
  • 1
    a pure apex option would be to use the Schema.Describe methods and loop through all fields in the returned map, using regex matching
    – cropredy
    Commented Nov 1, 2019 at 0:44

1 Answer 1

0

Well, the best option, in my opinion, is to use Salesforce Inspector:

After it is installed, you can access the Salesforce Inspector by clicking on the silver blue background arrow on top right from inside a record and click on "Show all data"

enter image description here

Then you can use the search function:

enter image description here

On the Filter search start typing the name of the field.... and voila :) The only thing you need to make sure is that you are inside the object to access the fields of that particular object...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .