2017-04-18 86 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天发生 - 您可以将此设置或任何其他参数设置为适合您的任何参数。这对我们很好,所以我希望它能帮助你。