I'm running into an issue with usage. I have a ven...
# suitescript
j
I'm running into an issue with usage. I have a vendor bill record loaded and I'm making a call to selectLine. According to the documentation (https://4119984.app.netsuite.com/app/help/helpcenter.nl?fid=section_4273169163.html&whence=), there should be no governance points. Yet, when i log my usage, it is clearly costing 5 points. Below is my code. Any thoughts? thanks.
Copy code
var curRecord = currentRecord.get();
var curRecordId = curRecord.getValue ({
		fieldId: 'id'
	});
			
// 10 points
var myRecord = record.load({
	type: record.Type.VENDOR_BILL,
	id: curRecordId,
	isDynamic: true
});

var itemListCount = myRecord.getLineCount({
	sublistId: 'item'
});

var activeItemCount=0		// position of an item in initial snapshot of the 	

while (activeItemCount < itemListCount) {

	 myRecord.selectLine({
		sublistId: "item",
		line: activeItemCount
	});
	console.log("Remaining governance units: " + scriptObj.getRemainingUsage());

	activeItemCount ++
}
b
probably want more code, enough to reproduce
for example, i dont know if myRecord is a currentRecord or a record
j
@battk that's fair. I edited the code above.
@battk I'm actually able read the data in that section of my code with a simple call to getSublistValue at no cost. But later i do need to use the selectLine call. This has certainly been a learning experience. I appreciate your help along the way!
b
Copy code
require(["N/currentRecord", "N/record", "N/runtime"], function (
  currentRecord,
  record,
  runtime
) {
  var curRecord = currentRecord.get();
  var scriptObj = runtime.getCurrentScript();
  var curRecordId = curRecord.getValue({
    fieldId: "id",
  });

  var myRecord = record.load({
    type: record.Type.VENDOR_BILL,
    id: curRecordId,
    isDynamic: true,
  });
  var itemListCount = myRecord.getLineCount({
    sublistId: "item",
  });
  var activeItemCount = 0;

  console.log("points before loop: " + scriptObj.getRemainingUsage());

  while (activeItemCount < itemListCount) {
    myRecord.selectLine({
      sublistId: "item",
      line: activeItemCount,
    });

    activeItemCount++;
  }

  console.log("points after loop: " + scriptObj.getRemainingUsage());
});
probably something else
j
that's strange. I was logging usage before and after the call. I'll investigate further, hmmmm
b
you can try looking at the network traffic, basically all things that consume points involve a network request
j
@battk I think i figured out where those "phantom" usage points were coming from. I Followed your suggestion to load the vendor bill, so i could read the poid field (worked perfectly). I then continued to do my processing on that record, as apposed to the "currentRecord". By switching back to the current record, I'm barely using any usage points. To be more efficient, i also created a bunch of arrays for same database access and lookups. thanks!