我在子列表中有GL帐户列,我想在子列表中单击该帐户名后导航到该特定帐户,因此我想添加超链接或某些内容以转到该帐户。
提前致谢!!
答案 0 :(得分:0)
我通过添加一个' View'来处理这个问题。列到我的子列表并使用setLinkText()
函数来设置显示文本。然后我执行搜索以获取我想要的记录并将它们添加到子列表中。然后我循环回到子列表并在View列上使用setLineItemValue()
,其中包含链接到记录的URL。
这是一个有效的Suitelet,列出了当前用户的费用报告,并提供了每个费用报告的链接:
function suitelet(request, response) {
var form = nlapiCreateForm('Expense Reports');
var expenseReportList = form.addSubList('custpage_expenses', 'list', 'Expenses');
expenseReportList.addField('custpage_view', 'url', 'View').setLinkText('View');
expenseReportList.addField('internalid', 'select', 'Expense Report', 'expensereport').setDisplayType('inline');
expenseReportList.addField('memo', 'text', 'Memo');
expenseReportList.addField('amount', 'currency', 'Amount');
var expenseReports = getExpenseReports(nlapiGetUser());
expenseReportList.setLineItemValues(expenseReports);
updateViewRecordLinks(expenseReports, expenseReportList);
response.writePage(form);
}
function getExpenseReports(employeeId) {
var results = nlapiSearchRecord('expensereport', null, [
new nlobjSearchFilter('entity', null, 'anyof', employeeId),
new nlobjSearchFilter('mainline', null, 'is', 'T')
], [
new nlobjSearchColumn('internalid'),
new nlobjSearchColumn('memo'),
new nlobjSearchColumn('amount')
]);
return results;
}
function updateViewRecordLinks(expenseReports, expenseReportList) {
for (var i = 0; expenseReports && i < expenseReports.length; i++)
{
var row = expenseReports[i];
var viewUrl = nlapiResolveURL('RECORD', 'expensereport', row.getId(), false);
expenseReportList.setLineItemValue('custpage_view', i + 1, viewUrl);
}
}