/ **
* @NApiVersion 2.x
* @NScriptType ClientScript
* @NModuleScope SameAccount
* /
определить ([ 'N / currentRecord', 'N / запись'],
функция (currentRecord, запись) {
function pageInit(scriptContext) {
}
function buttonclick() {
try{
var salesOrder = currentRecord.get();
console.log(salesOrder)
var recIdSO= salesOrder.id;
/ * var salesOrder = record.load ({
тип: record.Type.SALES_ORDER,
id: recIdSO,
isDynamic: правда
}); /
/ console.log ('recordid' + recIdSO);
* / /*log.debug ({
title: 'recordid',
детали: 'Id:' + recIdSO
}); * /
var line=salesOrder.selectNewLine({
sublistId: 'item'
});
console.log('line'+ line);
salesOrder.setCurrentSublistValue({
sublistId : 'item',
fieldId : 'item',
value :510 ,
ignoreFieldChange: true
});
salesOrder.setCurrentSublistValue({
sublistId : 'item',
fieldId : 'amount',
value :100 ,
ignoreFieldChange: true
});
salesOrder.setCurrentSublistValue({
sublistId : 'item',
fieldId : 'taxcode',
value :-160 ,
ignoreFieldChange: true
});
salesOrder.commitLine({
sublistId: 'item'
});
var recId = salesOrder.save();
log.debug({
title: 'Record updated successfully',
details: 'Id: ' + recId
});
}catch (e) {
console.log('recordid'+ recIdSO);
/*log.error({
title: e.name,
details: e.message
});*/
}
}
возврат {
pageInit: pageInit,
buttonclick:buttonclick
};
});