I trying to modify a Purchase Order when a user opens it. This seems like this is a really simple example but doesn't seem to work. In the GUI I don't see the "test" memo. And in the script debug the memo field is empty.
I know the script is running because of the debug.
/**
* Update Drop Ship PO with route Information
*
* @author Patrick
* @NApiVersion 2.0
* @NScriptType UserEventScript
*/
define(['N/search', 'N/record'],
function(search, record) {
function beforeLoad(context) {
var newRecord = context.newRecord;
newRecord.setValue({fieldId: 'memo', value: 'this is a test'});
log.debug({title: 'memo', details: newRecord.getValue({fieldId: 'memo'})});
return true;
}
return {
beforeLoad: beforeLoad
};
});
I am assuming it has something to do with the record I can modify but I can't for the life of me find a working example in the docs. Any help would be greatly appreciated.