Last active
August 29, 2015 14:19
-
-
Save lbrenman/f73567c3335fb35ed081 to your computer and use it in GitHub Desktop.
Appcelerator Arrow Salesforce Composite Connector Models for retrieving Account Details with Associated Opportunities for that 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","AccountDetail",{ | |
"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 | |
}, | |
"BillingAddress": { | |
"type": "string", | |
"description": "Billing Address", | |
"readonly": false, | |
"required": false, | |
"optional": true, | |
"writeonly": false | |
}, | |
"ShippingStreet": { | |
"type": "string", | |
"description": "Shipping Street", | |
"readonly": false, | |
"maxlength": 255, | |
"required": false, | |
"optional": true, | |
"writeonly": false | |
}, | |
"ShippingCity": { | |
"type": "string", | |
"description": "Shipping City", | |
"readonly": false, | |
"maxlength": 40, | |
"required": false, | |
"optional": true, | |
"writeonly": false | |
}, | |
"ShippingState": { | |
"type": "string", | |
"description": "Shipping State/Province", | |
"readonly": false, | |
"maxlength": 80, | |
"required": false, | |
"optional": true, | |
"writeonly": false | |
}, | |
"ShippingPostalCode": { | |
"type": "string", | |
"description": "Shipping Zip/Postal Code", | |
"readonly": false, | |
"maxlength": 20, | |
"required": false, | |
"optional": true, | |
"writeonly": false | |
}, | |
"Phone": { | |
"type": "string", | |
"description": "Account Phone", | |
"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 | |
}, | |
"Industry": { | |
"type": "string", | |
"description": "Industry", | |
"readonly": false, | |
"maxlength": 40, | |
"required": false, | |
"optional": true, | |
"writeonly": false | |
} | |
}, | |
"actions": [ | |
"create", | |
"read", | |
"update", | |
"delete", | |
"deleteAll" | |
], | |
"singular": "AccountDetail", | |
"plural": "AccountDetails" | |
}); | |
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
var Arrow = require("arrow"); | |
var Model = Arrow.Model.reduce("appc.salesforce/Account","AccountMaster",{ | |
"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 | |
}, | |
"Phone": { | |
"type": "string", | |
"description": "Account Phone", | |
"readonly": false, | |
"maxlength": 40, | |
"required": false, | |
"optional": true, | |
"writeonly": false | |
} | |
}, | |
"actions": [ | |
"create", | |
"read", | |
"update", | |
"delete", | |
"deleteAll" | |
], | |
"singular": "AccountMaster", | |
"plural": "AccountMasters" | |
}); | |
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
var Arrow = require("arrow"); | |
var Model = Arrow.createModel("AccountWithOpps",{ | |
"fields": { | |
"Account": { | |
"model": "AccountDetail", | |
"type": "Object" | |
}, | |
"Opportunity": { | |
"model": "Opportunity", | |
"type": "Array" | |
} | |
}, | |
"connector": "appc.composite", | |
"actions": [ | |
"create", | |
"read", | |
"update", | |
"delete", | |
"deleteAll" | |
], | |
"metadata": { | |
"left_join": [ | |
{ | |
"model": "Opportunity", | |
"multiple": true, | |
"join_properties": { | |
"AccountId": "id" | |
} | |
} | |
] | |
}, | |
"singular": "AccountWithOpps", | |
"plural": "AccountWithOppss" | |
}); | |
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
var Arrow = require("arrow"); | |
var Model = Arrow.Model.reduce("appc.salesforce/Opportunity","Opportunity",{ | |
"fields": { | |
"AccountId": { | |
"type": "string", | |
"description": "Account ID", | |
"readonly": false, | |
"maxlength": 18, | |
"required": false, | |
"optional": true, | |
"writeonly": false | |
}, | |
"Name": { | |
"type": "string", | |
"description": "Name", | |
"readonly": false, | |
"maxlength": 120, | |
"required": true, | |
"optional": false, | |
"writeonly": false | |
}, | |
"StageName": { | |
"type": "string", | |
"description": "Stage", | |
"readonly": false, | |
"maxlength": 40, | |
"required": true, | |
"optional": false, | |
"writeonly": false | |
}, | |
"Amount": { | |
"type": "number", | |
"description": "Amount", | |
"readonly": false, | |
"required": false, | |
"optional": true, | |
"writeonly": false | |
}, | |
"CloseDate": { | |
"type": "date", | |
"description": "Close Date", | |
"readonly": false, | |
"required": true, | |
"optional": false, | |
"writeonly": false | |
} | |
}, | |
"actions": [ | |
"create", | |
"read", | |
"update", | |
"delete", | |
"deleteAll" | |
], | |
"singular": "Opportunity", | |
"plural": "Opportunitys" | |
}); | |
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": "c3f4cead-78cf-4c63-90a0-e5cac2f822aa", | |
"key": "accountwithopp", | |
"accountwithopp": { | |
"id": "001i000000Pscf4AAB", | |
"Account": { | |
"id": "001i000000Pscf4AAB", | |
"Name": "Express Logistics and Transport", | |
"Type": "Customer - Channel", | |
"BillingAddress": { | |
"city": "Portland", | |
"country": null, | |
"countryCode": null, | |
"latitude": null, | |
"longitude": null, | |
"postalCode": null, | |
"state": "OR", | |
"stateCode": null, | |
"street": "620 SW 5th Avenue Suite 400\nPortland, Oregon 97204\nUnited States" | |
}, | |
"ShippingStreet": "620 SW 5th Avenue Suite 400\nPortland, Oregon 97204\nUnited States", | |
"Phone": "(503) 421-7800", | |
"Website": "www.expressl&t.net", | |
"Industry": "Transportation" | |
}, | |
"Opportunity": [ | |
{ | |
"id": "006i000000A6YYtAAN", | |
"AccountId": "001i000000Pscf4AAB", | |
"Name": "Express Logistics Portable Truck Generators", | |
"StageName": "Value Proposition", | |
"Amount": 80000, | |
"CloseDate": "2011-09-11T00:00:00.000Z" | |
}, | |
{ | |
"id": "006i000000A6YZ3AAN", | |
"AccountId": "001i000000Pscf4AAB", | |
"Name": "Express Logistics SLA", | |
"StageName": "Perception Analysis", | |
"Amount": 120000, | |
"CloseDate": "2011-09-11T00:00:00.000Z" | |
}, | |
{ | |
"id": "006i000000A6YYkAAN", | |
"AccountId": "001i000000Pscf4AAB", | |
"Name": "Express Logistics Standby Generator", | |
"StageName": "Closed Won", | |
"Amount": 220000, | |
"CloseDate": "2011-09-11T00:00:00.000Z" | |
} | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment