Netsuite:如何调试工作流动作脚本

时间:2016-11-09 11:04:51

标签: debugging workflow netsuite suitescript

我是新的套件脚本(基于Jets的Netsuite custumization)。 我有一个工作流动作脚本,想要通过Netsuite中的Scritp Debugger进行调试。但我无法在Debugger中看到我的工作流动作脚本,即使我调用了自定义动作。

我使用Eclipse IDE并将我的文件上传到Netsuite。这是我的代码,只需在创建empolyee费用报表时向员工添加费用报表信息。它有返回类型的问题。

function UpdateEmployeeWithExpenseReport()
{
   var stFrequentCriteria = nlapiGetContext().getSetting('SCRIPT',
        'custscript_oradata_freq_trav_limit');  // get value of the script parameter
   var intFrequentCriteria = parseInt(stFrequentCriteria); //the limit of frequency
   var recExpenseReport = nlapiGetNewRecord();
   var stEntity = recExpenseReport.getFieldValue('entity');  
   var today = new Date();
   var aMonthAgo = nlapiAddDays(today, -30); 
   // filter just the main lines of expenses
   var arrSearchFilters =  [
        new nlobjSearchFilter('employee', null, 'is', stEntity),
        new nlobjSearchFilter('trandate', null, 'within', aMonthAgo, today),
        new nlobjSearchFilter('mainline', null, 'is', 'T') ];                                                   
   var arrSearchColumns = [ new nlobjSearchColumn('internalid', null, 'count') ]; // Note: count is not a field, it just counts internal id based on  Empolyee expenses reports
   var arrSearchResults = nlapiSearchRecord('expensereport', null,
        arrSearchFilters, arrSearchColumns);
   var stCount = arrSearchResults[0].getValue(arrSearchColumns[0]); //                                                                  
   var count = parseInt(stCount);
   var stFrequentTraveler = '';
   if (count >= intFrequentCriteria)
   {
      stFrequentTraveler = 'Frequent';
   }
   else 
   {
    stFrequentTraveler = 'Infrequent';
   }

   var stAmount = recExpenseReport.getFieldValue('amount');
   var intExpenseLines = recExpenseReport.getLineItemCount('expense');
   var stNotes = '';
   stNotes += stFrequentTraveler + 'Traveler' + '\n';
   stNotes += 'Last Expense Report' + '\n';
   stNotes += '--Expense Report Total= ' + stAmount + '\n';
   stNotes += '--Expense Lines = ' + intExpenseLines;

   var recEmployee = nlapiLoadRecord('employee', stEntity); // 1 internal name of record, 2.internal id for the  record

   recEmployee.setFieldValue('comments', stNotes);
   nlapiLogExecution('tDEBUG', 'stEntity', stEntity);
   stEntity = recEmployee.getFieldValue('entityid');

1 个答案:

答案 0 :(得分:0)

为了让您的脚本显示在Netsuite Script Debugger中,您需要将状态设置为" Testing"在脚本部署记录中。