Prelude Interactive Logo
  • About
  • Blog
  • Connect
  • Home
  • Projects
  • Tags

    501 tech club accountants action address validation advocacy APEX APIs backups Blackbaud Congress contractors Convio craigslist data development finance freelancing interface iPhone JSON Kimbia McKinsey mobile multi-picklist NGO nonprofit nonprofits open source report SalesForce salespeople Schema social social actions social media technical help technical volunteers Twestival Twitter Twitter API USPS VisualForce volunteer volunteers work

    Social Actions

  • Categories

    • Life (6)
    • Nerding (17)
    • Nonprofiteering (16)
    • SalesForce (6)
  • Archives

    • July 2009
    • June 2009
    • May 2009
    • April 2009
    • March 2009
    • February 2009
    • January 2009
    • December 2008
    • November 2008
  • Meta

    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org
  • Recent Comments

    • Prelude Interactive / Social Actions vs. All For Good Smackdown (Part 2: Formats) on All For Good vs. Social Actions Smackdown (Part 1)
    • » Blog Archive » Nerd Alert: All For Good vs. Social Actions on All For Good vs. Social Actions Smackdown (Part 1)
    • Christine Egger on All For Good vs. Social Actions Smackdown (Part 1)
    • Ehren on All For Good vs. Social Actions Smackdown (Part 1)
    • adam sah on All For Good vs. Social Actions Smackdown (Part 1)

Extracting Schemas from SalesForce

It took me way too long to figure out how to get SalesForce to export schema information on an object.  It seemed so tantalizingly easy - the salesforce.schema file is right there in the IDE but it’s a placeholder for a dynamically updated widget…that won’t export the XML it clearly contains.

So, I learned about Maps, SObjectFields, and some other stuff.  I might have even helped this person out, who posted today about nearly the same thing.

Map<string,Schema.SObjectField> M =
  Schema.SObjectType.Organization_Detail__c.fields.getMap();
Set s = M.keySet();
for (String s1 : s) {
  SObjectField f = M.get(s1);
  Schema.DescribeFieldResult d = f.getDescribe();
  System.debug(logginglevel.INFO,d.getName() + ',' + d.getLabel());
}

Execute the above as anonymous, and you should get a comma separated set of names and labels.  I’m in no mood to figure out how to suppress the 20081127030828.685:AnonymousBlock: line 6, column 3: that it poops out, so I’ll trim it down in TextPad.

Post a comment Post a Comment — Trackback URI Trackback URI

XML RSS 2.0 feed for these comments

This entry (permalink) was posted on Wednesday, November 26th, 2008 at 9:15 PM by Ehren and categorized in Nerding.

Post a Comment

(Never published)
 
« On Contractors
The Nonprofit Marketplace »
Home

© 2009 Prelude Interactive | Powered by WordPress | Valid XHTML & CSS | Posts RSS & Comments RSS