we have a requirement where we need to search metadata within Salesforce for some specifc keywords? and also replace them. As an outside tool we can use Eclipse, but how it can be done within Salesforce?
4 Answers
I would take a look at the Metadata Wrapper Andrew Fawcett has written - in the git hub repo linked to above, he shows how you can build a MetaData browser...so I would think you can develop that to provide native search as well...
Step 1: Retrieve all metadata source from org using package.xml in VS Code.
Step 2: Use 'Find in Folder..' option on the root folder (./force-app/main/default) and search for your keyword.
Yes, There is a way we can access all metadata components and search for metadata within salesforce for some specific keyword by using the Describe call, Global describe.
You can first call describeGlobal() to retrieve a list of all objects for your organization, then iterate through the list and use describeSObjects() to obtain metadata about individual objects.
-
Thanks for your reply. But using this, i can't find a specfic keyword in an apex class? Commented Jun 24, 2014 at 4:17
You can access metadata for all the components in salesforce ONLY using Metadata API and for that you can use tools like Force.com IDE/ANT to download or retrieve entire metadata components which are available in eclipse and do a search for the component/variable/keyword name to see where it is referenced.
-
-
The answer also says 'only' which means you can search for the entire metadata only using metadata API. Commented Jun 23, 2014 at 8:39
-
2probably better framing that you cannot do without eclipse or ANT? Commented Jun 23, 2014 at 8:42
-
Actually, i have to built a visual force page where i can search all my Salesforce metadata (classes, triggers, reports, etc.) for keywords. Even if somehow, i used metadata api in apex, is there any call supported to Search metadata...? Is this can be done via. Tooling api...? Commented Jun 23, 2014 at 9:46
-
@ThisIsRSN, Mohit & Varun - You may want to checkout Metadata Search appexchange app sforce.co/1DedhGy. This is force.com app which supports searching Workflows, Validations, Recent Items, Fields, Objects, Reports, Dashboards, Custom Settings, Apps, Roles, Profiles, Permission Sets, Templates, Groups, Queues, Sites, Record Types, Assignments, Links, Resources, Classes, Triggers, Pages etc (Disclosure : I'm owner of this app, sorry for self promotion here.). Commented Jul 14, 2015 at 8:50