Discussions
Join the NetSuite community to innovate, connect, and discover what’s next.
SuiteWorld brings thousands of innovators, builders, and leaders together to learn, connect, and shape what’s next. This October, explore how to build a stronger foundation for growth through inspiring keynotes, major product reveals, hands-on sessions, and unforgettable moments—all in one place for our biggest event of the year. Register now
Copying a Record
Hi, im trying to write a suitescipt to copy a record to a new one. In this instance its a credit memo, but i cannot get it to work at all.
/**
* @NApiVersion 2.1
* @NScriptType ClientScript
*/
define(['N/record','N/ui/dialog'],
function (record,dialog) {
var exports = {};
function pageInit(context) {
// Do Nothing
}
function onButtonClick() {
var recordID = context.newRecord.id;
dialog.alert({
title: "Record ID",
message: recordID
})
var copyRecord = record.copy({
type: record.Type.CREDIT_MEMO,
id: recordID,
isDynamic: true
});
var submitCopyRecord = copyRecord.save({
enableSourcing: true,
ignoreMandatoryFields: true
})
}
exports.onButtonClick = onButtonClick;
exports.pageInit = pageInit;
return exports;
}