2017-04-18 90 views

回答

0

我在SuiteAnswers中找到了它,這足以滿足我的目的。

function printStatement() 
{ 
//this is is the customer id 
var id = nlapiGetRecordId(); 
var email = nlapiGetFieldValue('custentity_accounting_email');    
//create an array to set the STATEMENT properties(optional) 
var sdate = new Array(); 
sdate.startdate = '11/01/2015'; // replace it as per requirement 
sdate.statementdate = '11/30/2015'; // replace it as per requirement 
sdate.openonly = 'T'; // replace it as per requirement 
sdate.formnuber = 112; // replace it as per requirement 

//print the statement to a PDF file object 
var file = nlapiPrintRecord('STATEMENT', id, 'PDF', sdate); 

//send the PDF as an attachment 
nlapiSendEmail('-5', email, 'Regular Statement', 'Please see attached  Statment', null, null, null, file); //change the value of author id. 
} 
2

是的,但使用工作流程更容易。我們爲'聲明聯繫人'創建了一個自定義字段,並基於「保存的搜索過濾器」設置了一個計劃的工作流程,基本檢查客戶是否有餘額。有一個狀態包含一個「發送電子郵件」操作。 「發送電子郵件」操作可以選擇「包含聲明」。它在每個月的第4天發生 - 您可以將此設置或任何其他參數設置爲適合您的任何參數。這對我們很好,所以我希望它能幫助你。