Netsuite 使用record.load()加载子记录
我在Netsuite中创建了两个具有父子关系的自定义记录。现在我想在RESTlet中使用record.load方法加载子记录。当我使用record.load时,它应该自己加载子记录。但不幸的是,事实并非如此。求求你,有人,告诉我我是否遗漏了什么Netsuite 使用record.load()加载子记录,netsuite,Netsuite,我在Netsuite中创建了两个具有父子关系的自定义记录。现在我想在RESTlet中使用record.load方法加载子记录。当我使用record.load时,它应该自己加载子记录。但不幸的是,事实并非如此。求求你,有人,告诉我我是否遗漏了什么 function _get(context) { try { if(context.singleRecord == 'true') {
function _get(context)
{
try
{
if(context.singleRecord == 'true')
{
if(context.recordType == 'customrecord418')
{
var project = record.load({
type: 'customrecord418',
id: context.id
});
if(context.forEdit == 'true')
{
log.debug({title:"project", details: project});
return {
id : project.getValue({fieldId: "id"}),
custrecord729 : project.getValue({fieldId: "custrecord729"}),
custrecord734 : project.getValue({fieldId: "custrecord734"}),
custrecord733 : project.getValue({fieldId: "custrecord733"}),
custrecord732 : project.getValue({fieldId: "custrecord732"}),
custrecord731 : project.getValue({fieldId: "custrecord731"}),
custrecord730 : project.getValue({fieldId: "custrecord730"}),
name : project.getValue({fieldId: "name"}),
projectPhases : null
}
}
else
{
var projectPhases = [];
var numLines = project.getLineCount({
sublistId: 'recmachcustrecord739'
});
if (numLines > 0)
{
for (var i = 0; i < numLines; i++)
{
projectPhases.push({
id : project.getSublistValue({
sublistId : 'recmachcustrecord739',
fieldId : 'id',
line : i
}),
custrecord736 : project.getSublistValue({
sublistId : 'recmachcustrecord739',
fieldId : 'custrecord736',
line : i
}),
custrecord737 : project.getSublistValue({
sublistId : 'recmachcustrecord739',
fieldId : 'custrecord737',
line : i
}),
custrecord738 : project.getSublistValue({
sublistId : 'recmachcustrecord739',
fieldId : 'custrecord738',
line : i
}),
custrecord739 : project.getSublistValue({
sublistId : 'recmachcustrecord739',
fieldId : 'custrecord739',
line : i
}),
name : project.getSublistValue({
sublistId : 'recmachcustrecord739',
fieldId : 'name',
line : i
})
});
}
}
return {
id : project.getValue({fieldId: "id"}),
custrecord729 : project.getValue({fieldId: "custrecord729"}),
custrecord734 : project.getValue({fieldId: "custrecord734"}),
custrecord733 : project.getValue({fieldId: "custrecord733"}),
custrecord732 : project.getValue({fieldId: "custrecord732"}),
custrecord731 : project.getValue({fieldId: "custrecord731"}),
custrecord730 : project.getValue({fieldId: "custrecord730"}),
name : project.getValue({fieldId: "name"}),
projectPhases : projectPhases
}
}
}
else
{
var project = record.load({
type: 'customrecord421',
id: context.id
});
return {
id : project.getValue({fieldId: "id"}),
custrecord736 : project.getValue({fieldId: "custrecord736"}),
custrecord737 : project.getValue({fieldId: "custrecord737"}),
custrecord738 : project.getValue({fieldId: "custrecord738"}),
custrecord739 : project.getValue({fieldId: "custrecord739"}),
name : project.getValue({fieldId: "name"})
}
}
}
else
{
const projectList = [];
var resultSet = search.load({
id: 'customsearch4629'
})
.run()
.getRange({
start: 0,
end: 100
});
for(var i=0; i<resultSet.length; i++){
projectList.push({
id : resultSet[i].getValue({name: "id"}),
custrecord729 : resultSet[i].getValue({name: "custrecord729"}),
custrecord734 : resultSet[i].getValue({name: "custrecord734"}),
custrecord733 : resultSet[i].getValue({name: "custrecord733"}),
custrecord732 : resultSet[i].getText({name: "custrecord732"}),
custrecord731 : resultSet[i].getValue({name: "custrecord731"}),
custrecord730 : resultSet[i].getValue({name: "custrecord730"}),
name : resultSet[i].getValue({name: "name"})
});
}
return projectList;
}
}
catch(ex)
{
return String(ex.message);
}
}
您必须检查子记录中的允许子记录编辑首选项。您的代码在哪里?氪星我已经更新了问题并添加了代码,您可以查看它。