NetSuite – SuiteScript 2 Need to rename Vendors while displaying

I am newbie to NetSuite and wanted to show vendor names in specific format while displaying. Currently each vendor has auto-generated id with some prefix e.g.


These vendors are then shown as a sublist in other pages as following:

ABC0001 Mr. Vendor A
ABC0002 Mr. Vendor B
ABC0003 Mr. Vendor C

I want to show vendor name as Name only, without the id in sublists like below:

Mr. Vendor A
Mr. Vendor B
Mr. Vendor C

How is that possible? Currently I tried to use following SuiteScript, but its not working:

define(["N/record"], function (record) {
   *@NApiVersion 2.0
   *@NScriptType ClientScript

  function pageInit(context) {
    var itemRecord = record.load({
      type: record.Type.INVENTORY_ITEM,
      isDynamic: false,

    var lines = itemRecord.getLineCount({ sublistId: "itemvendor" });

    for (var i = 0; i < lines; i++) {
      var vendorName = itemRecord.getSublistText({
        sublistId: "itemvendor",
        fieldId: "vendor",
        line: i,

      var parts = vendorName.split(" ");
      vendorName = parts.join(" ");

        sublistId: "itemvendor",
        fieldId: "vendor",
        line: i,
        text: vendorName

  return {
    pageInit: pageInit,

Any idea what am I doing wrong here? Or is this even the right way to do it? Any help will be greatly appreciated.


Rookie Asked on January 21, 2023 in Vendors.
Add Comment
1 Answer(s)

The value you are getting for the field vendor in the itemvendor sublist is the id and not the name of the vendor. You will need to load the vendor record to get the name (companyname) of the vendor.

Beginner Answered on January 23, 2023.

Even if I get company name, how will I display it instead of vendor id?

on January 23, 2023.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Become a Sponsor   Become a Sponsor