0

We allow sales to attach Prospects to an Opportunity and Quote, and once credit has qualified the prospect they promote the prospect to a customer. What we need to do is hide the "Sales Order" button on the quote, or disallow advancing the quote to a sales order.

I was hesitant to ask this- seems like it should be intuitive to figure out. I looked at the standard NetSuite button id's in NetSuite help but there wasn't one for "Sales Order". I've looked at validation logic but this isn't validation as the sales order button is shown when record is not in edit mode. If possible I'd like the solution to be form independent.

I'd be happy to hide the button or letting the user click the button and preventing them from creating the sales order. It might be more user friendly doing the latter because if the button is hidden sales will be calling asking why the button is not there.

For clarity here is an image: enter image description here

Rich Bianco
  • 4,141
  • 3
  • 29
  • 48

2 Answers2

2

I am assuming that when you are talking about "the Sales Order button", you mean this one: NetSuite Sales Order button

I'm not sure if this is the best user experience, or if you have NetSuite development resources available to you, but here is one option:

Create a new User Event script that is deployed to the Sales Order (and any other Transaction record you may want this prevention on). Using the BeforeLoad event, you can check if the Entity on the Transaction is in the Prospect stage. If they are, then the script will throw an error, preventing the creation of the Transaction. Code to accomplish this:

function onBeforeLoad(type) {
    var entityId = nlapiGetFieldValue('entity');

    if ((type != 'create') || !entityId) { return; }

    if(nlapiLookupField('customer', nlapiGetFieldValue('entity'), 'stage') === 'PROSPECT') {
        throw nlapiCreateError('INVALID_REQUEST', 'You cannot create a Sales Order from a Quote placed for a Prospect');
    }
}

I tested this code in a TSTDRV account, and it works as expected. You might alternatively be able to build a workflow that does the same thing without requiring you to write code, but I did not attempt this.

By using a User Event script, this code will be form independent as well as entry point independent, meaning that this code will execute if the Sales Order is being created through the UI, through some other script, through a web services integration (depending on your web services configuration), or through a CSV import (depending on your CSV import configuration).

erictgrubaugh
  • 8,519
  • 1
  • 20
  • 28
  • Much appreciated++ I posted an image that shows the situation, but your solution will still work perfect. var thankYou = abortSOBeforeLoad.Select(new String { "You cannot create a Sales Order from Quote if Prospect has not been promoted to "Customer").Where(e => e.transactionType == "Quote").Where(e => e.entityType == "Prospect").OrderBy(e => e.stackoverflowhero == "egrubaugh360"); – Rich Bianco Oct 01 '15 at 23:40
  • I tested it out - works perfectly! I use stackoverflow mostly to answer questions because answering them helps me learn/remember but I was under pressure on this issue and so glad I asked. I hope to repay the favor someday. – Rich Bianco Oct 02 '15 at 00:31
1

To hide the option: If you're referring to the dropdown list, you can create a script for context view/edit to do the following:

setFieldAndLabelVisibility("nl13", false);

Otherwise, replace nl13 with the value of the table or td element shown when you inspect element on the desired Sales Order link/icon.

--The ID in the example above is the table, button or label ID shown when you inspect element

MBrewer
  • 81
  • 2
  • 9
  • This is another good idea - didn't think of it. Nice to see a few NetSuite experts around here. It's one of the tougher things I've had to pick up in a hurry. thank you. – Rich Bianco Nov 12 '15 at 22:16