Marty Zigman - The NetSuite Expert

Conversations with Marty Zigman

Certified Administrator • ERP • SuiteCloud

Prolecto Labs Accelerator Templates

Fix NetSuite Customer / Vendor ID Concatenation Mishaps

NetSuite Technical

Tags: , ,

This article is relevant if you are looking to clean up vendor or customer records that have incorrect ID or EntityIDs.

Background


NetSuite has a powerful capacity to allow vendors to be customers or other roles at the same time using the ‘Other Relationship’ feature.  You may find that when you activate that function, the entity will get an incorrect EntityID and then will look funny when you work with it in record references and lists.  See image for an example.  The EntityID (name) became concatenated together.  NetSuite’s basic editing tools may not make it easy to fix it up as the record is in a more complex multiple role relationship.

Custom Mass Update

I assume you have basic knowledge to create NetSuite scripts.  The following Mass Update script can be used to effectively take the Company Name and replace the problem Entity ID.  You then can target your problem entities and then clean it up quickly.

function MassUpdate_UpdateEntityID(rec_type, rec_id){
    var func = 'MassUpdate_UpdateEntityID ';
    nlapiLogExecution('DEBUG', func + rec_type + '- starting with id' + rec_id);
    
    if (rec_type != 'customer'){
    	nlapiLogExecution('DEBUG', func + rec_type + ' is not a customer, exiting');
    	return;
    };
    
    var c = nlapiLoadRecord('customer', rec_id);
    c.setFieldValue('entityid', c.getFieldValue('companyname'));
    nlapiSubmitRecord(c);
    
    nlapiLogExecution('DEBUG', func + rec_type + '- finished.');
    return;
};

 

Drive NetSuite Your Way

NetSuite is a platform designed to be enhanced.  Take control of your situation and make life better.  If you want to optimize your NetSuite account, contact us.

Marty Zigman

Holding all three official certifications, Marty is regarded as the top NetSuite expert and leads a team of senior professionals at Prolecto Resources, Inc. He is a former Deloitte & Touche CPA and has held CTO roles. For over 30 years, Marty has produced leadership in ERP, CRM and eCommerce business systems. Contact Marty to set up a conversation.

More Posts - Website - Twitter - Facebook - LinkedIn - YouTube

About Marty Zigman

Marty Zigman

Holding all three official certifications, Marty is regarded as the top NetSuite expert and leads a team of senior professionals at Prolecto Resources, Inc. He is a former Deloitte & Touche CPA and has held CTO roles. For over 30 years, Marty has produced leadership in ERP, CRM and eCommerce business systems. Contact Marty to set up a conversation.

Biography • Website • X (Twitter) • Facebook • LinkedIn • YouTube

2 thoughts on “Fix NetSuite Customer / Vendor ID Concatenation Mishaps

  1. Wade says:

    Thanks for blog. I used the concept to update the customer entity id after I turned off the “non-reversable” auto increment increment on the customer record.

    /**
    /**
    * @NApiVersion 2.1
    * @NScriptType MassUpdateScript
    */
    define([‘N/record’],
    /**
    * @param{record} record
    */
    (record) => {
    /**
    * Defines the Mass Update trigger point.
    * @param {Object} params
    * @param {string} params.type – Record type of the record being processed
    * @param {number} params.id – ID of the record being processed
    * @since 2016.1
    */
    const each = (params) => {
    var customerOBJ = record.load({
    type: record.Type.CUSTOMER,
    id: params.id,
    isDynamic: false
    });
    var isPerson = customerOBJ.getValue(‘isperson’);
    var cname = customerOBJ.getValue(‘companyname’);
    var fname = customerOBJ.getValue(‘firstname’);
    var lname = customerOBJ.getValue(‘lastname’);
    var fullName = fname + ‘ ‘ + lname;
    var eid = customerOBJ.getValue(‘entityid’);
    if(isPerson==’F’)
    {

    customerOBJ.setValue({fieldId: ‘entityid’, value: cname })
    .save({enableSourcing: false, ignoreMandatoryFields: false});
    }
    else
    {
    customerOBJ.setValue({fieldId: ‘entityid’, value: fullName })
    .save({enableSourcing: false, ignoreMandatoryFields: false});
    }
    }

    return {each}

    });

  2. Marty Zigman says:

    Thank you Wade for the code reference. It was 7 years ago I wrote that article.

    Marty

Leave a Reply

Your email address will not be published. Required fields are marked *