Monday, October 13, 2008

Got Dashboard/Report via MetaData API 14.0

I've got dashboard/report setting by salesforce meta data api 14.0 that has come out just now with Salesforce winter09.

1. login with starndard api url
2. get session id and metadata login url from the result of #1
3. access to the metadata url with the session id (with metadata namespce, of course) at the Header element and a metadata method at the Body element of SOAP message.
4. Issue a retrieve() metadata method.
5. does this following a way from Salesforce Metadata API direction. Metadata API Reference


--- qte ---
To retrieve packaged or unpackaged components:
5-1. Issue a retrieve() call to start the asynchronous retrieval. An AsyncResult object is returned. If the call is completed, the done field contains true. Most often, the call is not completed quickly enough to be noted in the result. If it is completed, note the value in the id field returned and skip the next step.

5-2. If the call is not complete, issue a checkStatus() call in a loop using the value in the id field of the AsyncResult object returned by the retrieve() call in the previous step. Check the AsyncResult object returned, until the done field contains true. The time taken to complete a retrieve() call depends on the size of the zip file being deployed, so a longer wait time between iterations should be used as the size of the zip file increases.

5-3. Issue a checkRetrieveStatus() call to obtain the results of the retrieve() call, using the id value returned in the first step.

6. get element result of retrieve method from the RerieveResult Object.
7. decode value of as base64
8. unzip the result of #7.
9. Success!



Fig1. folder upon unziping


Fig2. dashboard metadata as xml


The next step is to give it a thought how to delopy this dashboard on the Salesforce Android app.

2 Comments:

Blogger Carlos said...

Is it possible to retrieve multiple dashboards using one retrieve() call?

I specify an String[] as the value of specificFiles which is one of the parameter when I created RetrieveRequest object. I want to get the friendly name of the specificFiles. However, my RetrieveResult seems only has the dashboard for the first child in the specificFiles string array.

11:14 AM  
Blogger Carlos said...

nevermind, I figured it out!

11:47 AM  

Post a Comment

<< Home