Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing parameters to metadata calls #43

Open
boxfoot opened this issue Feb 21, 2013 · 3 comments
Open

Passing parameters to metadata calls #43

boxfoot opened this issue Feb 21, 2013 · 3 comments

Comments

@boxfoot
Copy link

boxfoot commented Feb 21, 2013

I'm trying to get a list of reports, and can't figure out how. The basic call should be something like:

objects = client.list_metadata "Report" 

but I can't figure out how to add in the parameter for report folder. Is this supported?

Related: listMetadata allows submitting up to three ListMetaDataQuery queries with each call. Is there a way to do that with metaforce?

@ejholmes
Copy link
Owner

Aren't Reports records? You'd probably be better off using Restforce

@boxfoot
Copy link
Author

boxfoot commented Feb 25, 2013

Reports (and Documents, EmailTemplates) are both records and metadata. I'm writing a utility to generate package.xml files, which means using metadata API to query for data types. Most types allow subscription with *, but these types require the use of listMetadata while specifying a folder name. While I could use Restforce to complement Metaforce, it should be possible to build the utility using just the Metadata API, so I'd like to do that if possible. See http://www.salesforce.com/us/developer/docs/api_meta/Content/meta_report.htm.

@chexxor
Copy link

chexxor commented Mar 8, 2013

I don't have a solution, but maybe this is useful.

I also want an easy way to pull down all Folder-based metadata

Here are some blog posts that detail some strategies:
http://www.pocketsoap.com/weblog/2008/10/1826.html
http://wiki.developerforce.com/page/Syncing_Salesforce_Org_Metadata_to_Github

To pull the actual metadata files locally, I should be able to do something like this:

    manifest = Metaforce::Manifest.new({:document => ['MyFolder', 'MyFolder/MyDocument']})
    client.retrieve_unpackaged(manifest).extract_to('./tmp').perform

We can't use '*', so we have to be specific with our metadata request. So, we still need to get a list of an org's folders, and all items in these folders. This SOQL query should get the folder names:

    SELECT Id, Name, DeveloperName, Type, NamespacePrefix, AccessType
    FROM Folder
    ORDER BY Name DESC

Then to get the items in these folders, we have to query data records for folder-based metadata, which is Reports, Documents, Dashboards, and EmailTemplates:

    SELECT Id, Name, DeveloperName, IsDeleted, NamespacePrefix
    FROM Report
    ORDER BY Name DESC

I don't have good base knowledge in this area, so I don't know what the problem is. A problem with my org's security settings for my folder-based metadata? A problem with Metaforce? A problem with the Metadata API?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants