js 获取当前日期+时间
nlapiDateToString(new Date())
new Date() 可以得到当前日期.
var cur_time = (new Date()).getTime(); 获取当前时间.
------------------------------------------
Example 1
The following example uses nlapiTransformRecord to create an Item Fulfillment record from an existing Sales Order record.
var itemfulfillment = nlapiTransformRecord('salesorder', 1500, 'itemfulfillment')
itemfulfillment.setFieldValue('trandate', nlapiDateToString(new Date()) )
Example 2
function trans()
{
var fromrecord;
var fromid;
var torecord;
var trecord;
var qty;
fromrecord = 'purchaseorder';
fromid = 26 ; // Transform PO with ID = 26 ;
torecord = 'itemreceipt';
// Transaform a record with given id to a different record type.
// For example - from PO to Item Receipt
// Get the object of the transformed record.
trecord = nlapiTransformRecord(fromrecord, fromid, torecord,true);
qty = trecord.getLineItemValue('item', 'quantity', 1 );
trecord.setLineItemValue('item', 'quantity', 1, '2' );
var idl = nlapiSubmitRecord(trecord, true);
nlapiSendEmail(-5, -5, 'Transform Email' + 'Original Qty =
' + qty + ' ' + 'Record Created = ' + idl , null);
}
Example 3
/* Assembly item Name = Computer and Id = 328
Location Name = West and Id = 3 // When Multi Location inventory is enabled
2 Member components of Assembly item
Member 1 Name = CPU - Quantity = 2
Member 2 Name = Memory - Quantity = 4
*/
function transformtest1()
{
var fromRecord = 'assemblyitem';
var fromId = 328;
var toRecord = 'build';
var defaultV = new Array();
defaultV.quantity =1; // Default quantity to build
defaultV.location ='3'; // Default location id
var record = nlapiTransformRecord(fromRecord, fromId, toRecord, defaultV);
var id = nlapiSubmitRecord(record, false);
}
本文来自博客园,作者:CarlZeng,转载请注明原文链接:https://www.cnblogs.com/backuper/archive/2008/10/04/1303942.html
需求沟通链接 扫客服加群:
![](https://images.cnblogs.com/cnblogs_com/backuper/933606/o_240408031754_%E6%89%AB%E5%AE%A2%E6%9C%8D%E5%8A%A0%E7%BE%A4.png)