我一直在尝试使用 jsforce 库创建联系人列表视图。
var metadata4 = [{
fullName: 'LISTTEST1',
label: 'LISTTEST1',
filterScope: 'Everything',
columns: [{
"ascendingLabel": "Z-A",
"descendingLabel": "A-Z",
"fieldNameOrPath": "Name",
"hidden": false,
"label": "Name",
"searchable": true,
"selectListItem": "Name",
"sortDirection": "ascending",
"sortIndex": 0,
"sortable": true,
"type": "string"
},
{
"ascendingLabel": "Z-A",
"descendingLabel": "A-Z",
"fieldNameOrPath": "Account.Name",
"hidden": false,
"label": "Account Name",
"searchable": true,
"selectListItem": "Account.Name",
"sortDirection": null,
"sortIndex": null,
"sortable": true,
"type": "string"
},
{
"ascendingLabel": "Z-A",
"descendingLabel": "A-Z",
"fieldNameOrPath": "Title",
"hidden": false,
"label": "Title",
"searchable": true,
"selectListItem": "Title",
"sortDirection": null,
"sortIndex": null,
"sortable": true,
"type": "string"
},
{
"ascendingLabel": "9-0",
"descendingLabel": "0-9",
"fieldNameOrPath": "Phone",
"hidden": false,
"label": "Phone",
"searchable": true,
"selectListItem": "Phone",
"sortDirection": null,
"sortIndex": null,
"sortable": true,
"type": "phone"
},
{
"ascendingLabel": "Z-A",
"descendingLabel": "A-Z",
"fieldNameOrPath": "Email",
"hidden": false,
"label": "Email",
"searchable": true,
"selectListItem": "Email",
"sortDirection": null,
"sortIndex": null,
"sortable": true,
"type": "email"
},
{
"ascendingLabel": "Z-A",
"descendingLabel": "A-Z",
"fieldNameOrPath": "Owner.Alias",
"hidden": false,
"label": "Contact Owner Alias",
"searchable": false,
"selectListItem": "Owner.Alias",
"sortDirection": null,
"sortIndex": null,
"sortable": true,
"type": "string"
},
{
"ascendingLabel": null,
"descendingLabel": null,
"fieldNameOrPath": "Id",
"hidden": true,
"label": "Contact ID",
"searchable": false,
"selectListItem": "Id",
"sortDirection": null,
"sortIndex": null,
"sortable": false,
"type": "id"
},
{
"ascendingLabel": null,
"descendingLabel": null,
"fieldNameOrPath": "CreatedDate",
"hidden": true,
"label": "Created Date",
"searchable": false,
"selectListItem": "CreatedDate",
"sortDirection": null,
"sortIndex": null,
"sortable": false,
"type": "datetime"
},
{
"ascendingLabel": null,
"descendingLabel": null,
"fieldNameOrPath": "LastModifiedDate",
"hidden": true,
"label": "Last Modified Date",
"searchable": false,
"selectListItem": "LastModifiedDate",
"sortDirection": null,
"sortIndex": null,
"sortable": false,
"type": "datetime"
},
{
"ascendingLabel": null,
"descendingLabel": null,
"fieldNameOrPath": "SystemModstamp",
"hidden": true,
"label": "System Modstamp",
"searchable": false,
"selectListItem": "SystemModstamp",
"sortDirection": null,
"sortIndex": null,
"sortable": false,
"type": "datetime"
},
{
"ascendingLabel": null,
"descendingLabel": null,
"fieldNameOrPath": "Account.Id",
"hidden": true,
"label": "Account ID",
"searchable": false,
"selectListItem": "Account.Id",
"sortDirection": null,
"sortIndex": null,
"sortable": false,
"type": "id"
},
{
"ascendingLabel": null,
"descendingLabel": null,
"fieldNameOrPath": "AccountId",
"hidden": true,
"label": "Account ID",
"searchable": false,
"selectListItem": "AccountId",
"sortDirection": null,
"sortIndex": null,
"sortable": false,
"type": "reference"
},
{
"ascendingLabel": null,
"descendingLabel": null,
"fieldNameOrPath": "Owner.Id",
"hidden": true,
"label": "User ID",
"searchable": false,
"selectListItem": "Owner.Id",
"sortDirection": null,
"sortIndex": null,
"sortable": false,
"type": "id"
},
{
"ascendingLabel": null,
"descendingLabel": null,
"fieldNameOrPath": "OwnerId",
"hidden": true,
"label": "Owner ID",
"searchable": false,
"selectListItem": "OwnerId",
"sortDirection": null,
"sortIndex": null,
"sortable": false,
"type": "reference"
}
]
}]
conn.metadata.create("CustomObject", metadata4, function(err, ret) {
if (err || !ret.success) { return console.error(err, ret); }
console.log("Created record id : " + ret.id);
});
当我运行以下命令时没有任何反应。我是 Salesforce 开发的新手,很难找到有关元数据 api 的更多帮助。