Marty Zigman Marty Zigman
Prolecto Labs Accelerator Templates

Convert a NetSuite Lead to a Vendor

CRM NetSuite

Tags: , , ,

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.

Backgroud

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/company.nl?e=T&target=s_relation:otherrelationships&label=Other+Relationships&fromtype=custjob&id=' + recid + '&totype=vendor';
    nlapiRequestURL(url);

    // now try to load the vendor record to confirm we did the work
    var worked = false;
    try{
        nlapiLoadRecord('vendor', recid);
        worked = true;
    }catch(e){
        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;
        return;
    }
}

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.

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

14 thoughts on “Convert a NetSuite Lead to a Vendor

  1. Robert says:

    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. Marty Zigman says:

    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.

    Marty

  3. Sudheer says:

    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. Marty Zigman says:

    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 says:

    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. Marty Zigman says:

    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. 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.

    /app/common/entity/company.nl?e=T&target=s_relation:otherrelationships&label=Other+Relationships&fromtype=custjob&id=myexistingid&totype=vendor

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

    Maybe this not work anymore?
    Thanks in advance!
    Guillermo

  8. Marty Zigman says:

    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?

    Marty

  9. 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. Marty Zigman says:

    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.

    Marty

  11. Felipe Machado Almei says:

    Is it possible to do this logic on RESTlet?

  12. Marty Zigman says:

    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.

    Marty

  13. Sai says:

    Hello Marty,

    Is there a way to convert lead/customer to vendor using otherrelationship from server scripts? I need to convert lead/customer to vendor when created via webstore? is it possible?Please let me know.

    thanks

  14. Marty Zigman says:

    Hi Sai,

    I may be wrong but I still do not see a way to do this server side. I need to keep my eye open for this possibility.

    Marty

Leave a Reply

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