Skip to content

Instantly share code, notes, and snippets.

@nickfogle
Forked from hyperking/CRM designation parser
Last active November 9, 2015 14:28
Show Gist options
  • Save nickfogle/ee0e9da67c3a6e9b5918 to your computer and use it in GitHub Desktop.
Save nickfogle/ee0e9da67c3a6e9b5918 to your computer and use it in GitHub Desktop.
BBCRM Response Formatter
var allFunds = CRMresponse.Rows;
function beautifyCRM(allFunds) {
colleges = {}
$(allFunds).each(function(key, val) {
var list = val['Values'];
console.log(list);
var cname = list[2].split("\\").pop();
var fund = list[0];
var guid = list[3];
var desc = list[4];
var category = list[2].split("\\");
try {
colleges[cname].push({
"fund": fund,
"guid": guid,
"categories": category,
"description": desc
})
} catch (err) {
colleges[cname] = [{
"fund": fund,
"guid": guid,
"categories": category,
"description": desc
}]
}
});
return colleges
}
console.log(beautifyCRM(allFunds));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment