Thursday, November 22, 2018

Provide a Sample script to create a Validate Line Failure message for Scriptable cart messaging

 

Validate Line Failure in version 2011.2 has the same look and feel of the web site unlike the previous version which has NetSuite branded page. This allows consistent shopper experience.

Here is a Sample code:

function customValidateLine(type)
{
          // All validations occur in the item tab, so if that's not where we are, ignore it.
          if (type != 'item')
          {
                    return true;
          }

          alert('Validate line called');
          
          //Always fail the addition of the Item with the internal ID of 4
          var itemID = nlapiGetCurrentLineItemValue ('item', 'item');
          if (itemID == '4')
          {
                   //For the validation failure, we use alerts instead of nlapiLogexecution
                    alert('Sorry - this item is onhold due to safety issues.');
                    return false;
          }
}



To Deploy Script, see "Deploying and Running Scriptable Cart" in Online Help Guide.

No comments:

Post a Comment