Sam L
01/14/2021, 3:37 PMcreece
01/14/2021, 3:40 PMPNJ
01/14/2021, 3:57 PMSandii
01/14/2021, 4:00 PMThe transaction will not be saved, so I cant do a record.update.
, you are saying you want to do the edits in the suitelet, and have it go back to the transaction in edit mode with the changes you made from the suitelet, maybe?Sam L
01/14/2021, 4:17 PMeminero
01/14/2021, 4:24 PMSam L
01/14/2021, 9:32 PMSam L
01/14/2021, 9:33 PMcreece
01/14/2021, 9:35 PMfunction addSelectedItems(dataIn) {
var itemSelectionRecord = dataIn.itemSelectionRecord;
const SELECTED_ITEMS = getSelectedItems({
itemSelectionRecord: itemSelectionRecord
});
const PRIMARY_SYSTEM_CODE_ROLE_ID = itemSelectionRecord.getValue({
fieldId: PCG_OEW_CONSTANTS.ITEM_SELECTION_FORM.HEADER.FIELD.PRIMARY_SYSTEM_CODE_ID.id
});
if (!SELECTED_ITEMS.length) {
dialog.alert({
title: PCG_OEW_CONSTANTS.DIALOG.NO_ITEM_SELECTED.title,
message: PCG_OEW_CONSTANTS.DIALOG.NO_ITEM_SELECTED.message
}).then().catch();
return;
}
window.onbeforeunload = function() {}; // Get rid of the "are you sure..." popup when navigating away
window.opener.require(['N/currentRecord'], function(currentRecord) {
var currentTransaction = currentRecord.get();
for (var i = 0; i < SELECTED_ITEMS.length; i++) {
currentTransaction.selectNewLine({
sublistId: PCG_OEW_CONSTANTS.RECORD.TRANSACTION.SUBLIST.ITEM.ID
});
currentTransaction.setCurrentSublistValue({
sublistId: PCG_OEW_CONSTANTS.RECORD.TRANSACTION.SUBLIST.ITEM.ID,
fieldId: PCG_OEW_CONSTANTS.RECORD.TRANSACTION.SUBLIST.ITEM.FIELD.ITEM.id,
value: SELECTED_ITEMS[i].id,
forceSyncSourcing: true
});
currentTransaction.setCurrentSublistValue({
sublistId: PCG_OEW_CONSTANTS.RECORD.TRANSACTION.SUBLIST.ITEM.ID,
fieldId: PCG_OEW_CONSTANTS.RECORD.TRANSACTION.SUBLIST.ITEM.FIELD.PRIMARY_SYSTEM_CODE.id,
value: PRIMARY_SYSTEM_CODE_ROLE_ID,
forceSyncSourcing: true
})
currentTransaction.commitLine({
sublistId: PCG_OEW_CONSTANTS.RECORD.TRANSACTION.SUBLIST.ITEM.ID
});
}
window.close();
});
}
creece
01/14/2021, 9:39 PMcreece
01/14/2021, 9:40 PMSam L
01/15/2021, 9:42 AMSam L
01/15/2021, 9:43 AM