JR
01/28/2021, 4:53 PMvar poListCount = myRecord.getLineCount({
sublistId: 'purchaseorders'
});
var activePoCount = 0
while (activePoCount < poListCount) {
var mypoId = myRecord.getSublistValue({
sublistId: 'purchaseorders',
fieldId: 'poid',
line: activePoCount
activePoCount++
}
ericbirdsall
01/28/2021, 4:56 PMJR
01/28/2021, 5:11 PMericbirdsall
01/28/2021, 5:12 PMJR
01/28/2021, 5:14 PMericbirdsall
01/28/2021, 5:15 PM.getSublistText
instead of .getSublistValue
?JR
01/28/2021, 5:16 PMJR
01/28/2021, 5:19 PMJR
01/28/2021, 5:21 PMbattk
01/28/2021, 5:21 PMbattk
01/28/2021, 5:21 PMrequire(["N/record"], function (record) {
var myRecord = record.load({ type: "vendorbill", id: 28956 });
var poListCount = myRecord.getLineCount({
sublistId: "purchaseorders",
});
var activePoCount = 0;
while (activePoCount < poListCount) {
var mypoId = myRecord.getSublistValue({
sublistId: "purchaseorders",
fieldId: "poid",
line: activePoCount,
});
log.debug(activePoCount, mypoId);
activePoCount++;
}
});
battk
01/28/2021, 5:21 PMbattk
01/28/2021, 5:22 PMericbirdsall
01/28/2021, 5:26 PMJR
01/28/2021, 5:35 PM// 2.0
/**
* @NApiVersion 2.x
* @NScriptType UserEventScript
* @NModuleScope SameAccount
*/
define(['N/record', 'N/ui/serverWidget' ],
function(record)
{
return {
beforeLoad : function(context){
var form = context.form;
form.addButton({
id : "custpage_addcreditcardfee_button",
label : "Reconcile Bill",
functionName : "reconcile_bill"
});
form.clientScriptModulePath = "/SuiteScripts/reconcile_bill_cl.js";
}
}
});
The top of my client script looks like this
/**
* @NApiVersion 2.x
* @NScriptType ClientScript
* @NModuleScope SameAccount
*/
define(['N/record', 'N/currentRecord', 'N/search', 'N/runtime', 'N/ui/dialog', './utilities/lodash'],
function (record, currentRecord, search, runtime, dialog, _) {
......
function reconcile_bill() {
battk
01/28/2021, 6:35 PMJR
01/28/2021, 7:23 PMvar curRecord = currentRecord.get();
var curRecordId = curRecord.getValue ({
fieldId: 'id'
});
var myRecord = record.load({
type: record.Type.VENDOR_BILL,
id: curRecordId,
isDynamic: true
});