2015-05-18 69 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哥們,它解決了................. –