2015-05-18 45 views
0

我已经在netsuite中创建了一个表单,它在发布之后应该重定向到选定的记录。这没有发生 - 我做错了什么?Netsuite表单不重定向

if (request.getMethod() == 'GET') { 
    var slcustomer = form.addField('custpage_selectfield', 'select', 
            'Customer', 'customer'); 
    form.addSubmitButton('Submit'); //For submiting as i will check for post back 
    response.writePage(form); //Write the form or display the form 
} else { 
    if (request.getMethod() == 'POST') { 
     var task = request.getParameter('slcustomer'); 
     nlapiSetRedirectURL('RECORD', 'task', null, false); 
    } 
} 

回答

0

我试过在suitelet函数里面使用你的代码,它对我很有用。

function suitelet(request, response){ 
    if (request.getMethod() == 'GET') { 
     var form = nlapiCreateForm('My Custom Form', false); 
     var slcustomer = form.addField('custpage_selectfield', 'select', 
             'Customer', 'customer'); 
     form.addSubmitButton('Submit'); //For submiting as i will check for post back 
     response.writePage(form); //Write the form or display the form 
    } else { 
     if (request.getMethod() == 'POST') { 
      var customerid = request.getParameter('custpage_selectfield'); 
      nlapiLogExecution('debug', 'selected id', customerid); 
      nlapiSetRedirectURL('RECORD', 'task', null, false); 
     } 
    } 
} 
+0

var form = nlapiCreateForm('My Custom Form',false); PLZ解释你为什么给予虚假参数。 –

+0

nlapiSetRedirectURL('RECORD','task',null,false);在从任务中删除''之后,它也不会在所需的记录中出现............而是抛出n个错误,即标识符 –

+0

您是否试过放置上述代码片段。你还在犯错误吗? – Rockstar

0
var slcustomer = form.addField('custpage_selectfield', 'select', 
            'Customer', 'customer'); 

这行创建了一个下拉的客户记录列表。

var task = request.getParameter('custpage_selectfield'); 
nlapiLogExecution('debug', 'selected id', task); 
nlapiSetRedirectURL('RECORD', 'task', null, false); 

任务变量应该包含所选客户的内部ID。您的nlapiSetRedirectURL调用不正确。如果你想重定向到选定的客户,它应该是

nlapiSetRedirectURL('RECORD', 'customer', task); 
+0

Thanx哥们,它解决了................. –