-
Notifications
You must be signed in to change notification settings - Fork 0
/
account.js
42 lines (36 loc) · 1.43 KB
/
account.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Account page
//
var jsforce = require('jsforce');
exports.View =
{
title: "Account",
elements:
[
{ control: "stackpanel", orientation: "Vertical", height: "*", width: "*", contents: [
{ control: "stackpanel", orientation: "Horizontal", width: "*", contents: [
{ control: "image", resource: "{$root.imgAccount}", height: 50, width: 50 },
{ control: "text", value: "{Name}", width: "*", font: { bold: true, size: 12 } },
] },
{ control: "text", value: "Industry: {Industry}", width: "*", font: { size: 12 } },
{ control: "text", value: "Employees: {NumberOfEmployees}", width: "*", font: { size: 12 } },
{ control: "text", value: "Rating: {Rating}", visibility: "{Rating}", width: "*", font: { size: 12 } },
] },
]
}
exports.InitializeViewModel = function * (context, session, params)
{
console.log("Loading account id: ", params.accountId);
var conn = new jsforce.Connection(
{
instanceUrl: session.sf_instanceUrl,
accessToken: session.sf_accessToken
});
var account = yield Synchro.yieldAwaitable(context, function(callback)
{
conn.sobject("Account").retrieve(params.accountId, callback);
});
console.log("Account: " + JSON.stringify(account, 0, 4));
var viewModel = account;
viewModel.imgAccount = Synchro.getResourceUrl(context, "account.png");
return viewModel;
}