Netsuite添加以案例形式创建新的采购订单按钮

时间:2013-05-12 03:10:42

标签: button netsuite

netsuite的新手,我正在尝试将案例系统用作我们物业管理公司的工单系统。我希望能够从案例记录中创建采购订单并将其自动链接回来。我已经购买订单中的自定义字段以链接案例;但我正在尝试在案例表单上创建一个创建采购订单按钮。

我知道我必须制作一个套件,然后将其附加到表单设置中的自定义操作子选项卡,我需要帮助编写setscript文件。

3 个答案:

答案 0 :(得分:4)

要向案例记录添加按钮,请在加载案例记录之前设置用户事件。 用户事件将是这样的:

function BeforeLoadCase(type, form) {
try {
    form.setScript('customscript_create_po');
    form.addButton('custpage_custombutton', 'Create PO', 'CreatePO()');
}
catch (err) {
    nlapiLogExecution('error', 'BeforeLoadCase', err);
}}

' customscript_create_po ':这是一个客户端脚本,可在按钮点击时打开新的采购订单记录。其代码如下:

function CreatePO() {
var url = nlapiResolveURL('record', 'purchaseorder', null, 'edit') + '?case_id=' + nlapiGetRecordId();
window.open(url, "New Purchase Order");}

现在,在采购订单上部署用户事件(加载前),代码有点像:

function BeforeLoadPO(type, form, request) {
if (type == 'create' && request.getParameter('case_id') != null) {
    var caseRecord = nlapiLoadRecord('supportcase', request.getParameter('case_id'));

}}

答案 1 :(得分:0)

您的脚本应如下所示

location.href = nlapiResolveURL('record','purchaseorder',null,'edit') + '?case_id=' + nlapiGetRecordId();

您还需要在采购订单的加载事件之前处理此查询字符串参数,并将其设置在自定义字段中。

答案 2 :(得分:0)

请改用此代码:

window.location.href = nlapiResolveURL('record','purchaseorder') + '?record.custbody1=' + nlapiGetRecordId();

该代码应将您重定向到您的PO表单,然后为您预先填充自定义字段。