Created
May 28, 2015 01:56
-
-
Save lbrenman/72d9f60bfbaba97c116c to your computer and use it in GitHub Desktop.
Appcelerator Arrow Salesforce Composite Model Example - Contact With Account
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Arrow = require("arrow"); | |
var Model = Arrow.Model.reduce("appc.salesforce/Account","Account",{ | |
"fields": { | |
"Name": { | |
"type": "string", | |
"description": "Account Name", | |
"readonly": false, | |
"maxlength": 255, | |
"required": true, | |
"optional": false, | |
"writeonly": false | |
}, | |
"Type": { | |
"type": "string", | |
"description": "Account Type", | |
"readonly": false, | |
"maxlength": 40, | |
"required": false, | |
"optional": true, | |
"writeonly": false | |
}, | |
"Website": { | |
"type": "string", | |
"description": "Website", | |
"readonly": false, | |
"maxlength": 255, | |
"required": false, | |
"optional": true, | |
"writeonly": false | |
} | |
}, | |
"actions": [ | |
"create", | |
"read", | |
"update", | |
"delete", | |
"deleteAll" | |
], | |
"singular": "Account", | |
"plural": "Accounts" | |
}); | |
module.exports = Model; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"success": true, | |
"request-id": "367b9e74-503f-43ba-95c6-6f78a6775778", | |
"key": "accounts", | |
"accounts": [ | |
{ | |
"id": "001i000000PscewAAB", | |
"Name": "GenePoint", | |
"Type": "Customer - Channel", | |
"Website": "www.genepoint.com" | |
}, | |
{ | |
"id": "001i000000PscexAAB", | |
"Name": "United Oil & Gas, UK", | |
"Type": "Customer - Direct", | |
"Website": "http://www.uos.com" | |
}, | |
{ | |
"id": "001i000000PsceyAAB", | |
"Name": "United Oil & Gas, Singapore", | |
"Type": "Customer - Direct", | |
"Website": "http://www.uos.com" | |
}, | |
{ | |
"id": "001i000000PscezAAB", | |
"Name": "Edge Communications", | |
"Type": "Customer - Direct", | |
"Website": "http://edgecomm.com" | |
}, | |
{ | |
"id": "001i000000Pscf0AAB", | |
"Name": "Burlington Textiles Corp of America", | |
"Type": "Customer - Direct", | |
"Website": "www.burlington.com" | |
}, | |
{ | |
"id": "001i000000Pscf1AAB", | |
"Name": "Pyramid Construction Inc.", | |
"Type": "Customer - Channel", | |
"Website": "www.pyramid.com" | |
}, | |
{ | |
"id": "001i000000Pscf2AAB", | |
"Name": "Dickenson plc", | |
"Type": "Customer - Channel", | |
"Website": "dickenson-consulting.com" | |
}, | |
{ | |
"id": "001i000000Pscf3AAB", | |
"Name": "Grand Hotels & Resorts Ltd", | |
"Type": "Customer - Direct", | |
"Website": "www.grandhotels.com" | |
}, | |
{ | |
"id": "001i000000Pscf4AAB", | |
"Name": "Express Logistics and Transport", | |
"Type": "Customer - Channel", | |
"Website": "www.expressl&t.net" | |
}, | |
{ | |
"id": "001i000000Pscf5AAB", | |
"Name": "University of Arizona", | |
"Type": "Customer - Direct", | |
"Website": "www.universityofarizona.com" | |
}, | |
{ | |
"id": "001i000000Pscf6AAB", | |
"Name": "United Oil & Gas Corp.", | |
"Type": "Customer - Direct", | |
"Website": "http://www.uos.com" | |
}, | |
{ | |
"id": "001i000000Pscf7AAB", | |
"Name": "sForce", | |
"Website": "www.sforce.com" | |
} | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Arrow = require("arrow"); | |
var Model = Arrow.Model.reduce("appc.salesforce/Contact","Contact",{ | |
"fields": { | |
"AccountId": { | |
"type": "string", | |
"description": "Account ID", | |
"readonly": false, | |
"maxlength": 18, | |
"required": false, | |
"optional": true, | |
"writeonly": false | |
}, | |
"LastName": { | |
"type": "string", | |
"description": "Last Name", | |
"readonly": false, | |
"maxlength": 80, | |
"required": true, | |
"optional": false, | |
"writeonly": false | |
}, | |
"FirstName": { | |
"type": "string", | |
"description": "First Name", | |
"readonly": false, | |
"maxlength": 40, | |
"required": false, | |
"optional": true, | |
"writeonly": false | |
}, | |
"Name": { | |
"type": "string", | |
"description": "Full Name", | |
"readonly": false, | |
"maxlength": 121, | |
"required": true, | |
"optional": false, | |
"writeonly": false | |
} | |
}, | |
"actions": [ | |
"create", | |
"read", | |
"update", | |
"delete", | |
"deleteAll" | |
], | |
"singular": "Contact", | |
"plural": "Contacts" | |
}); | |
module.exports = Model; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"success": true, | |
"request-id": "ac0f27b5-cf70-4ad1-ab08-42c298f42e35", | |
"key": "contacts", | |
"contacts": [ | |
{ | |
"id": "003i000000M33B3AAJ", | |
"AccountId": "001i000000PscezAAB", | |
"LastName": "Gonzalez", | |
"FirstName": "Rose", | |
"Name": "Rose Gonzalez" | |
}, | |
{ | |
"id": "003i000000M33B4AAJ", | |
"AccountId": "001i000000PscezAAB", | |
"LastName": "Forbes", | |
"FirstName": "Sean", | |
"Name": "Sean Forbes" | |
}, | |
{ | |
"id": "003i000000M33B5AAJ", | |
"AccountId": "001i000000Pscf0AAB", | |
"LastName": "Rogers", | |
"FirstName": "Jack", | |
"Name": "Jack Rogers" | |
}, | |
{ | |
"id": "003i000000M33B6AAJ", | |
"AccountId": "001i000000Pscf1AAB", | |
"LastName": "Stumuller", | |
"FirstName": "Pat", | |
"Name": "Pat Stumuller" | |
}, | |
{ | |
"id": "003i000000M33B7AAJ", | |
"AccountId": "001i000000Pscf2AAB", | |
"LastName": "Young", | |
"FirstName": "Andy", | |
"Name": "Andy Young" | |
}, | |
{ | |
"id": "003i000000M33B8AAJ", | |
"AccountId": "001i000000Pscf3AAB", | |
"LastName": "Barr", | |
"FirstName": "Tim", | |
"Name": "Tim Barr" | |
}, | |
{ | |
"id": "003i000000M33B9AAJ", | |
"AccountId": "001i000000Pscf3AAB", | |
"LastName": "Bond", | |
"FirstName": "John", | |
"Name": "John Bond" | |
}, | |
{ | |
"id": "003i000000M33BAAAZ", | |
"AccountId": "001i000000Pscf6AAB", | |
"LastName": "Pavlova", | |
"FirstName": "Stella", | |
"Name": "Stella Pavlova" | |
}, | |
{ | |
"id": "003i000000M33BBAAZ", | |
"AccountId": "001i000000Pscf6AAB", | |
"LastName": "Boyle", | |
"FirstName": "Lauren", | |
"Name": "Lauren Boyle" | |
}, | |
{ | |
"id": "003i000000M33BCAAZ", | |
"AccountId": "001i000000Pscf4AAB", | |
"LastName": "Levy", | |
"FirstName": "Babara", | |
"Name": "Babara Levy" | |
}, | |
{ | |
"id": "003i000000M33BDAAZ", | |
"AccountId": "001i000000Pscf4AAB", | |
"LastName": "Davis", | |
"FirstName": "Josh", | |
"Name": "Josh Davis" | |
}, | |
{ | |
"id": "003i000000M33BEAAZ", | |
"AccountId": "001i000000Pscf5AAB", | |
"LastName": "Grey", | |
"FirstName": "Jane", | |
"Name": "Jane Grey" | |
}, | |
{ | |
"id": "003i000000M33BFAAZ", | |
"AccountId": "001i000000Pscf6AAB", | |
"LastName": "Song", | |
"FirstName": "Arthur", | |
"Name": "Arthur Song" | |
}, | |
{ | |
"id": "003i000000M33BGAAZ", | |
"AccountId": "001i000000PscexAAB", | |
"LastName": "James", | |
"FirstName": "Ashley", | |
"Name": "Ashley James" | |
}, | |
{ | |
"id": "003i000000M33BHAAZ", | |
"AccountId": "001i000000PsceyAAB", | |
"LastName": "Ripley", | |
"FirstName": "Tom", | |
"Name": "Tom Ripley" | |
}, | |
{ | |
"id": "003i000000M33BIAAZ", | |
"AccountId": "001i000000PsceyAAB", | |
"LastName": "D'Cruz", | |
"FirstName": "Liz", | |
"Name": "Liz D'Cruz" | |
}, | |
{ | |
"id": "003i000000M33BJAAZ", | |
"AccountId": "001i000000PscewAAB", | |
"LastName": "Frank", | |
"FirstName": "Edna", | |
"Name": "Edna Frank" | |
}, | |
{ | |
"id": "003i000000M33BKAAZ", | |
"AccountId": "001i000000Pscf6AAB", | |
"LastName": "Green", | |
"FirstName": "Avi", | |
"Name": "Avi Green" | |
}, | |
{ | |
"id": "003i000000M33BLAAZ", | |
"AccountId": "001i000000Pscf7AAB", | |
"LastName": "Nedaerk", | |
"FirstName": "Siddartha", | |
"Name": "Siddartha Nedaerk" | |
}, | |
{ | |
"id": "003i000000M33BMAAZ", | |
"AccountId": "001i000000Pscf7AAB", | |
"LastName": "Llorrac", | |
"FirstName": "Jake", | |
"Name": "Jake Llorrac" | |
} | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Arrow = require("arrow"); | |
var Model = Arrow.createModel("ContactWithAccount",{ | |
"fields": { | |
"Contact": { | |
"model": "Contact", | |
"type": "Object" | |
}, | |
"Account": { | |
"model": "Account", | |
"type": "Object" | |
} | |
}, | |
"connector": "appc.composite", | |
"actions": [ | |
"create", | |
"read", | |
"update", | |
"delete", | |
"deleteAll" | |
], | |
"metadata": { | |
"left_join": [ | |
{ | |
"model": "Account", | |
"join_properties": { | |
"id": "AccountId" | |
} | |
} | |
] | |
}, | |
"singular": "ContactWithAccount", | |
"plural": "ContactWithAccounts" | |
}); | |
module.exports = Model; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"success": true, | |
"request-id": "040c561c-7d29-40f7-aa60-e0e6fa5afbab", | |
"key": "contactwithaccounts", | |
"contactwithaccounts": [ | |
{ | |
"id": "003i000000M33B3AAJ", | |
"Contact": { | |
"id": "003i000000M33B3AAJ", | |
"AccountId": "001i000000PscezAAB", | |
"LastName": "Gonzalez", | |
"FirstName": "Rose", | |
"Name": "Rose Gonzalez" | |
}, | |
"Account": { | |
"id": "001i000000PscezAAB", | |
"Name": "Edge Communications", | |
"Type": "Customer - Direct", | |
"Website": "http://edgecomm.com" | |
} | |
}, | |
{ | |
"id": "003i000000M33B4AAJ", | |
"Contact": { | |
"id": "003i000000M33B4AAJ", | |
"AccountId": "001i000000PscezAAB", | |
"LastName": "Forbes", | |
"FirstName": "Sean", | |
"Name": "Sean Forbes" | |
}, | |
"Account": { | |
"id": "001i000000PscezAAB", | |
"Name": "Edge Communications", | |
"Type": "Customer - Direct", | |
"Website": "http://edgecomm.com" | |
} | |
}, | |
{ | |
"id": "003i000000M33B5AAJ", | |
"Contact": { | |
"id": "003i000000M33B5AAJ", | |
"AccountId": "001i000000Pscf0AAB", | |
"LastName": "Rogers", | |
"FirstName": "Jack", | |
"Name": "Jack Rogers" | |
}, | |
"Account": { | |
"id": "001i000000Pscf0AAB", | |
"Name": "Burlington Textiles Corp of America", | |
"Type": "Customer - Direct", | |
"Website": "www.burlington.com" | |
} | |
}, | |
{ | |
"id": "003i000000M33B6AAJ", | |
"Contact": { | |
"id": "003i000000M33B6AAJ", | |
"AccountId": "001i000000Pscf1AAB", | |
"LastName": "Stumuller", | |
"FirstName": "Pat", | |
"Name": "Pat Stumuller" | |
}, | |
"Account": { | |
"id": "001i000000Pscf1AAB", | |
"Name": "Pyramid Construction Inc.", | |
"Type": "Customer - Channel", | |
"Website": "www.pyramid.com" | |
} | |
}, | |
{ | |
"id": "003i000000M33B7AAJ", | |
"Contact": { | |
"id": "003i000000M33B7AAJ", | |
"AccountId": "001i000000Pscf2AAB", | |
"LastName": "Young", | |
"FirstName": "Andy", | |
"Name": "Andy Young" | |
}, | |
"Account": { | |
"id": "001i000000Pscf2AAB", | |
"Name": "Dickenson plc", | |
"Type": "Customer - Channel", | |
"Website": "dickenson-consulting.com" | |
} | |
}, | |
{ | |
"id": "003i000000M33B8AAJ", | |
"Contact": { | |
"id": "003i000000M33B8AAJ", | |
"AccountId": "001i000000Pscf3AAB", | |
"LastName": "Barr", | |
"FirstName": "Tim", | |
"Name": "Tim Barr" | |
}, | |
"Account": { | |
"id": "001i000000Pscf3AAB", | |
"Name": "Grand Hotels & Resorts Ltd", | |
"Type": "Customer - Direct", | |
"Website": "www.grandhotels.com" | |
} | |
}, | |
{ | |
"id": "003i000000M33B9AAJ", | |
"Contact": { | |
"id": "003i000000M33B9AAJ", | |
"AccountId": "001i000000Pscf3AAB", | |
"LastName": "Bond", | |
"FirstName": "John", | |
"Name": "John Bond" | |
}, | |
"Account": { | |
"id": "001i000000Pscf3AAB", | |
"Name": "Grand Hotels & Resorts Ltd", | |
"Type": "Customer - Direct", | |
"Website": "www.grandhotels.com" | |
} | |
}, | |
{ | |
"id": "003i000000M33BAAAZ", | |
"Contact": { | |
"id": "003i000000M33BAAAZ", | |
"AccountId": "001i000000Pscf6AAB", | |
"LastName": "Pavlova", | |
"FirstName": "Stella", | |
"Name": "Stella Pavlova" | |
}, | |
"Account": { | |
"id": "001i000000Pscf6AAB", | |
"Name": "United Oil & Gas Corp.", | |
"Type": "Customer - Direct", | |
"Website": "http://www.uos.com" | |
} | |
}, | |
{ | |
"id": "003i000000M33BBAAZ", | |
"Contact": { | |
"id": "003i000000M33BBAAZ", | |
"AccountId": "001i000000Pscf6AAB", | |
"LastName": "Boyle", | |
"FirstName": "Lauren", | |
"Name": "Lauren Boyle" | |
}, | |
"Account": { | |
"id": "001i000000Pscf6AAB", | |
"Name": "United Oil & Gas Corp.", | |
"Type": "Customer - Direct", | |
"Website": "http://www.uos.com" | |
} | |
}, | |
{ | |
"id": "003i000000M33BCAAZ", | |
"Contact": { | |
"id": "003i000000M33BCAAZ", | |
"AccountId": "001i000000Pscf4AAB", | |
"LastName": "Levy", | |
"FirstName": "Babara", | |
"Name": "Babara Levy" | |
}, | |
"Account": { | |
"id": "001i000000Pscf4AAB", | |
"Name": "Express Logistics and Transport", | |
"Type": "Customer - Channel", | |
"Website": "www.expressl&t.net" | |
} | |
}, | |
{ | |
"id": "003i000000M33BDAAZ", | |
"Contact": { | |
"id": "003i000000M33BDAAZ", | |
"AccountId": "001i000000Pscf4AAB", | |
"LastName": "Davis", | |
"FirstName": "Josh", | |
"Name": "Josh Davis" | |
}, | |
"Account": { | |
"id": "001i000000Pscf4AAB", | |
"Name": "Express Logistics and Transport", | |
"Type": "Customer - Channel", | |
"Website": "www.expressl&t.net" | |
} | |
}, | |
{ | |
"id": "003i000000M33BEAAZ", | |
"Contact": { | |
"id": "003i000000M33BEAAZ", | |
"AccountId": "001i000000Pscf5AAB", | |
"LastName": "Grey", | |
"FirstName": "Jane", | |
"Name": "Jane Grey" | |
}, | |
"Account": { | |
"id": "001i000000Pscf5AAB", | |
"Name": "University of Arizona", | |
"Type": "Customer - Direct", | |
"Website": "www.universityofarizona.com" | |
} | |
}, | |
{ | |
"id": "003i000000M33BFAAZ", | |
"Contact": { | |
"id": "003i000000M33BFAAZ", | |
"AccountId": "001i000000Pscf6AAB", | |
"LastName": "Song", | |
"FirstName": "Arthur", | |
"Name": "Arthur Song" | |
}, | |
"Account": { | |
"id": "001i000000Pscf6AAB", | |
"Name": "United Oil & Gas Corp.", | |
"Type": "Customer - Direct", | |
"Website": "http://www.uos.com" | |
} | |
}, | |
{ | |
"id": "003i000000M33BGAAZ", | |
"Contact": { | |
"id": "003i000000M33BGAAZ", | |
"AccountId": "001i000000PscexAAB", | |
"LastName": "James", | |
"FirstName": "Ashley", | |
"Name": "Ashley James" | |
}, | |
"Account": { | |
"id": "001i000000PscexAAB", | |
"Name": "United Oil & Gas, UK", | |
"Type": "Customer - Direct", | |
"Website": "http://www.uos.com" | |
} | |
}, | |
{ | |
"id": "003i000000M33BHAAZ", | |
"Contact": { | |
"id": "003i000000M33BHAAZ", | |
"AccountId": "001i000000PsceyAAB", | |
"LastName": "Ripley", | |
"FirstName": "Tom", | |
"Name": "Tom Ripley" | |
}, | |
"Account": { | |
"id": "001i000000PsceyAAB", | |
"Name": "United Oil & Gas, Singapore", | |
"Type": "Customer - Direct", | |
"Website": "http://www.uos.com" | |
} | |
}, | |
{ | |
"id": "003i000000M33BIAAZ", | |
"Contact": { | |
"id": "003i000000M33BIAAZ", | |
"AccountId": "001i000000PsceyAAB", | |
"LastName": "D'Cruz", | |
"FirstName": "Liz", | |
"Name": "Liz D'Cruz" | |
}, | |
"Account": { | |
"id": "001i000000PsceyAAB", | |
"Name": "United Oil & Gas, Singapore", | |
"Type": "Customer - Direct", | |
"Website": "http://www.uos.com" | |
} | |
}, | |
{ | |
"id": "003i000000M33BJAAZ", | |
"Contact": { | |
"id": "003i000000M33BJAAZ", | |
"AccountId": "001i000000PscewAAB", | |
"LastName": "Frank", | |
"FirstName": "Edna", | |
"Name": "Edna Frank" | |
}, | |
"Account": { | |
"id": "001i000000PscewAAB", | |
"Name": "GenePoint", | |
"Type": "Customer - Channel", | |
"Website": "www.genepoint.com" | |
} | |
}, | |
{ | |
"id": "003i000000M33BKAAZ", | |
"Contact": { | |
"id": "003i000000M33BKAAZ", | |
"AccountId": "001i000000Pscf6AAB", | |
"LastName": "Green", | |
"FirstName": "Avi", | |
"Name": "Avi Green" | |
}, | |
"Account": { | |
"id": "001i000000Pscf6AAB", | |
"Name": "United Oil & Gas Corp.", | |
"Type": "Customer - Direct", | |
"Website": "http://www.uos.com" | |
} | |
}, | |
{ | |
"id": "003i000000M33BLAAZ", | |
"Contact": { | |
"id": "003i000000M33BLAAZ", | |
"AccountId": "001i000000Pscf7AAB", | |
"LastName": "Nedaerk", | |
"FirstName": "Siddartha", | |
"Name": "Siddartha Nedaerk" | |
}, | |
"Account": { | |
"id": "001i000000Pscf7AAB", | |
"Name": "sForce", | |
"Website": "www.sforce.com" | |
} | |
}, | |
{ | |
"id": "003i000000M33BMAAZ", | |
"Contact": { | |
"id": "003i000000M33BMAAZ", | |
"AccountId": "001i000000Pscf7AAB", | |
"LastName": "Llorrac", | |
"FirstName": "Jake", | |
"Name": "Jake Llorrac" | |
}, | |
"Account": { | |
"id": "001i000000Pscf7AAB", | |
"Name": "sForce", | |
"Website": "www.sforce.com" | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment