我搜索了几天,却找不到如何将自定义字段放入标准SalesForce对象(帐户,销售线索,商机等)中。我仅找到此处描述的有关元数据API的信息,但它说明了仅在自定义objets上插入新的元数据。我也找到了此代码,但它也仅适用于自定义对象。有人对这件事了解更多吗?谢谢。
此代码来自https://jsforce.github.io/document/#metadata-api
// creating metadata in array
var metadata = [{
fullName: 'TestObject1__c',
label: 'Test Object 1',
pluralLabel: 'Test Object 1',
nameField: {
type: 'Text',
label: 'Test Object Name'
},
deploymentStatus: 'Deployed',
sharingModel: 'ReadWrite'
}, {
fullName: 'TestObject2__c',
label: 'Test Object 2',
pluralLabel: 'Test Object 2',
nameField: {
type: 'AutoNumber',
label: 'Test Object #'
},
deploymentStatus: 'InDevelopment',
sharingModel: 'Private'
}];
conn.metadata.create('CustomObject', metadata, function(err, results) {
if (err) { console.err(err); }
for (var i=0; i < results.length; i++) {
var result = results[i];
console.log('success ? : ' + result.success);
console.log('fullName : ' + result.fullName);
}
});