Discussions
Join us for complimentary one-day events around the world and step into a future fueled by AI and limitless potential. Explore new breakthroughs, sharpen your skills, and connect with experts who are shaping what’s next. Experience bold keynotes, interactive learning, and connections that span the global NetSuite community. Discover what's next at SuiteConnect Tour 2026.
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;
}