Convert a NetSuite Lead to a Vendor

This article is relevant if you are working with NetSuite CRM and instead of converting leads to customers, you want to convert them to vendors.


One of the great things about NetSuite is that an entity can be many things at the same time.  Many NetSuite users are not aware that they can turn a Customer into a Vendor or Partner using the Other Relationships  function.  The power of this feature is that you can create invoices to customers and you can send checks to them as vendors.

We have clients that work in brokering businesses.  They match their customers to their suppliers to make markets.  Their lead generation work may bring them new customers or new suppliers (vendors).  In their CRM work, using different inbound techniques, they appropriately capture information suggesting a new lead is a customer or it is vendor.

NetSuite’s default “Convert Lead” function will change a lead into a prospect record. ¬†A prospect record is effectively a customer record with a status this is not won. ¬† ¬†There is no out-of-the-box mechanism to instead convert a NetSuite lead to a vendor.

Solving the Convert to NetSuite Lead to Vendor Challenge

The key to solve this problem is to understand that NetSuite provides a way convert customers to  vendors.  This is done via a client side link that calls a NetSuite server side function.  By appropriately calling the right URL with key information, we can convert the customer to a vendor.   Below is the client side code to do this:

function Convert_Lead_To_Vendor() {
    var recid = nlapiGetRecordId();

	//only act if we get a record ID
    if (!recid) return;

	//ask the user if they really want to do this
	if (!confirm("Are you sure you want to convert this lead to a vendor?"))return;

    // hitting this url will add the entity as a vendor
    var url = '/app/common/entity/' + recid + '&totype=vendor';

    // now try to load the vendor record to confirm we did the work
    var worked = false;
        nlapiLoadRecord('vendor', recid);
        worked = true;
        worked = false;

	//if it worked, redirect the user to the entity vendor view
    if (worked){
        var url = nlapiResolveURL('RECORD', 'lead', recid) + '&custparam_flag_lead='+CONST_CUSTSTATUS_APPROVED + '&custparam_next_entity=vendor';
        document.location = url;

Take Control over NetSuite

Remember, NetSuite is a platform designed to give you control over your business functions. If you are looking to get more out of your NetSuite investment by being creative to drive innovation and hence more value, let’s have a conversation.

Be Sociable, Share!

Marty Zigman

Holding all three official certifications, Marty is Southern California's 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 25 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 - Google Plus - YouTube

| Tags: , , , | Category: CRM, NetSuite | 12 Comments


  1. Robert
    Posted October 7, 2015 at 12:19 pm | Permalink

    How are you implementing this code? Here is an scenario of what I am trying to accomplish. I will have a website that a user will fill out a questionnaire. The questions and answers will be attached to a NetSuite Lead via RESTlet and asp page. From the questions the company will decided if the lead is eligible to move forward. If they move forward the lead will need to be converted to a Vendor. Also the questions the lead answered will be carried over also.

  2. Posted October 9, 2015 at 5:49 am | Permalink

    Hi Robert,

    Indeed, this works. The key to this function is that it is client side. Your workflow is all server side so the best I can offer is to figure out how to get the users to work the records client side as some part of their manual review flow.


  3. Sudheer
    Posted June 6, 2017 at 11:10 am | Permalink

    Hi Marty, I have a requirement of bulk importing(CSV/WebServices) the vendors to Netsuite wherein it should create a customer with server side scripting(user event). It seems this can achieved only through Client side scripting , but not with server side scripting(user event), Any suggestions to achieve this..
    Thanks in Advance.

  4. Posted June 10, 2017 at 3:06 pm | Permalink

    Hi Sudheer,

    We haven’t found a way to do it server side. Conceptually, you may be able to call the URL from a server but you will have to hold the credential and mimic cookies in your headers (another way is via JSessionID) to fool NetSuite to think you are authenticated.

  5. Kevin
    Posted June 29, 2017 at 7:52 pm | Permalink

    Interesting, we also need to setup our CRM to convert some leads to customers and some leads to Vendors. We basically need two pipelines in Netsuite – one for customers and one for vendors.

    The other issue I have run into – somewhat related to this, is we have a custom record that has a “vendor” field and stores the Vendor Name for the corresponding vendor. When you create the vendor from the Other Relationship tab, Netsuite will not let you use that vendor in the custom table – netsuite does not even recognize the related vendor as a “real” vendor. I am assuming this has to do with the fact the vendor was created from a customer?

  6. Posted July 12, 2017 at 5:06 pm | Permalink

    Have you considered the following?:

    1. Target the creation of a custom record instead of lead. Then, work that custom record to ultimately create a customer or vendor.

    2. On your custom record, use an entity type versus a vendor or customer. Then set the filter type to be customer or vendor. This will allow you to attach both.

  7. Posted May 18, 2018 at 4:28 pm | Permalink

    Hi Marty!

    This is exactly what i’m looking for, but i have an error executing the script, even if i paste this URL with an existing lead ID.


    An unexpected error has occurred. Please click here to notify support and provide your contact information.

    Maybe this not work anymore?
    Thanks in advance!

  8. Posted May 20, 2018 at 11:57 am | Permalink

    Hi Guillermo,

    Your comment came over and I can’t tell if the HTML got parsed. It’s hard for me to see the issue. But might you need to URL encode the values?


  9. Posted May 21, 2018 at 9:26 am | Permalink

    Thanks, Marty! The problem was that “Other Relationship” were not available in Lead form. This field must be available in order to work properly.
    This “Conversion” do not transform a Lead record into Vendor, right? Just create a Vendor record associated with the Lead record.
    I do not understand redirection line. What do you mean with CONST_CUSTSTATUS_APPROVED ? and instead of ‘Lead’ should be ‘Vendor’, right?
    Thank you so much for all your post!

  10. Posted May 28, 2018 at 1:19 pm | Permalink

    Hello Guillermo,

    I should have explained that the parameters, custparam_flag_lead and custparam_next_entity, are simply used by the target the user beforeload event on the vendor record to draw special UI elements to end-user. But these elements are not needed at all for this solution to work.


  11. Felipe Machado Almei
    Posted January 17, 2019 at 11:41 am | Permalink

    Is it possible to do this logic on RESTlet?

  12. Posted January 19, 2019 at 9:00 am | Permalink

    Hello Felipe, unless something has changed, no. This appears to only work client side and thus we can’t get control over it via Restlets. I would love to see this change and hope to be corrected.


Post a Comment

Your email is never published nor shared. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>