Skip to content

Instantly share code, notes, and snippets.

@forcementor
Created October 17, 2012 18:31
Show Gist options
  • Save forcementor/3907228 to your computer and use it in GitHub Desktop.
Save forcementor/3907228 to your computer and use it in GitHub Desktop.
Developing Mobile Applications with Force.com and Sencha Touch - Part 1, Step 6: Build Out The Sencha Touch Application - Generate Some Lead JSON
//Run this code in an APEX Execute Anonymous window:
List<Lead> leadList = [SELECT FirstName ,LastName ,Company ,Title ,Phone ,Email ,Status FROM Lead LIMIT 5];
system.debug(JSON.serializePretty(leadList));
/*Your results will be as follows in the DEBUG LOG.
*Find the USER_DEBUG line and copy all the JSON
*starting with the '[' delimiter thru the ending ']' delimiter
*and paste into your data store as the data content.
*The 'attributes' content is not used by Sencha, but you
*don't have to remove them as they will simply be ignored.
*Output on the DEBUG line will look something like
*this for five records as set by the SOQL LIMIT:
11:26:46.060 (60490000)|USER_DEBUG|[2]|DEBUG|[ {
"attributes" : {
"type" : "Lead",
"url" : "/services/data/v26.0/sobjects/Lead/00Q5000000dSItmEAG"
},
"FirstName" : "Test",
"LastName" : "Lead 088",
"Company" : "Test Company 088",
"Title" : "Test Title",
"Phone" : "555-555-5555",
"Email" : "tlead088@testco.com",
"Status" : "Open - Not Contacted"
}, {
"attributes" : {
"type" : "Lead",
"url" : "/services/data/v26.0/sobjects/Lead/00Q5000000dSItnEAG"
},
"FirstName" : "Test",
"LastName" : "Lead 089",
"Company" : "Test Company 089",
"Title" : "Test Title",
"Phone" : "555-555-5555",
"Email" : "tlead089@testco.com",
"Status" : "Open - Not Contacted"
}, {
"attributes" : {
"type" : "Lead",
"url" : "/services/data/v26.0/sobjects/Lead/00Q5000000dSItoEAG"
},
"FirstName" : "Test",
"LastName" : "Lead 090",
"Company" : "Test Company 090",
"Title" : "Test Title",
"Phone" : "555-555-5555",
"Email" : "tlead090@testco.com",
"Status" : "Open - Not Contacted"
}, {
"attributes" : {
"type" : "Lead",
"url" : "/services/data/v26.0/sobjects/Lead/00Q5000000dSItpEAG"
},
"FirstName" : "Test",
"LastName" : "Lead 091",
"Company" : "Test Company 091",
"Title" : "Test Title",
"Phone" : "555-555-5555",
"Email" : "tlead091@testco.com",
"Status" : "Open - Not Contacted"
}, {
"attributes" : {
"type" : "Lead",
"url" : "/services/data/v26.0/sobjects/Lead/00Q5000000dSItqEAG"
},
"FirstName" : "Test",
"LastName" : "Lead 092",
"Company" : "Test Company 092",
"Title" : "Test Title",
"Phone" : "555-555-5555",
"Email" : "tlead092@testco.com",
"Status" : "Open - Not Contacted"
} ]
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment