Alex McCullough
07/05/2023, 5:08 PMdefine([
'N/currentRecord',
], function (
currentRecord,
) {
var exports = {};
function pageInit(context) {
console.log("pageInit Triggered!");
}
exports.pageInit = pageInit;
function handleGenerateDelivPacketButtonClick() {
debugger;
let rec = currentRecord.get();
// All of the following function calls return undefined
let recCustomerId = rec.getValue('entity');
let recCustomerId2 = rec.getText('entity');
let recCustomerId3 = rec.getValue({ fieldId: 'entity' });
let recCustomerId4 = rec.getText({ fieldId: 'entity' });
// This returns the ship date accurately (e.g. '6/28/2023')
let recShipDate = rec.getValue('shipdate');
}
exports.handleGenerateDelivPacketButtonClick = handleGenerateDelivPacketButtonClick;
}
erictgrubaugh
07/05/2023, 5:25 PMVIEW
mode, then the CurrentRecord
instance will not contain any field values, only its recordtype
and id
. You can use those values to use N/record.load()
or N/search.lookupFields()
to retrieve the entity
.Alex McCullough
07/05/2023, 5:33 PMAlex McCullough
07/05/2023, 5:34 PMerictgrubaugh
07/05/2023, 6:59 PMNathan L
07/05/2023, 8:35 PMcurrentRecord.get().getText({fieldId: 'somefield'})
Nathan L
07/05/2023, 8:35 PMNathan L
07/05/2023, 8:36 PMAlex McCullough
07/05/2023, 8:38 PMAlex McCullough
07/05/2023, 8:39 PMNathan L
07/05/2023, 8:40 PMAlex McCullough
07/05/2023, 8:42 PMNathan L
07/05/2023, 8:42 PM