Thursday, June 6, 2019

Prevent users from altering line items related to special orders through client-side script

There are instances where the user would like to restrict line items associated to special orders from being altered.

To be able to meet the said use case, one can create a validate line triggered client side script such as below:

function clientValidateLine(type){
if (type=='item') {
 var specialOrderLine = nlapiGetCurrentLineItemValue('item','createpo');
    if( (specialOrderLine != null || specialOrderLine !='') && (specialOrderLine != 'SpecOrd'))
        return true;
 alert('This is a special order item. Clicking on OK is prohibited to avoid changes to this line.');

Disclaimer: The above sample is only as presented as an alternate solution to an existing Enhancement Request # 268961 Special Sales Order > requesting the ability to restrict editing of line items with attached Special Order PO's. Support to the sample code is not warranted.  The test cases conducted for the above sample is very limited and there is no guarantee that it will work in the future versions of NetSuite. Netsuite Inc. shall not be liable for any direct, indirect or consequential damages or costs of any type arising out of any action taken by you or others related to the sample code.

No comments:

Post a Comment