Question

I have looked through a lot of Netsuite's documentation and searched on stackoverflow and do not see this currently answered.

I basically want to lock down (disable end user from changing) certain fields on a Sales Order that affect margin after certain conditions are met. I have been able to lock down the fields I wanted on the item level, but I realized they can still add/copy/delete an item, which affects margin as well.

I do not want to lock down the entire item sublist - we want them to be able to edit minor things, but the actual items cannot be added/copied/deleted.

Any ideas how I can do this? Basically somehow remove the buttons for add/copy/remove?

EDIT: Due to the removal of my Javascript tag, I will explain it's purpose. This removal, because at the line level, I know will need to be done in SuiteScript- Javascript using NetSuite's API. It is relevant to note this is the language I am trying to utilize.

Code: To explain what I have done so far, below is some pseudocode:

function pageInit(){
if(currDate >= dLockDate && type == 'edit'){        
    //lock SO Date (header level)
    nlapiDisableField('trandate', true);                        
}
}

In lineInit://locks down some fields at the line item level

function lineInit(){
if(type == 'item'){
//list of items to disable
    var a_itemDisFields = ['rate', 'quantity','porate','amount', 'item'];

    for(var i = 0; i < a_itemDisFields.length; i++){
        nlapiDisableLineItemField('item',a_itemDisFields[i] , true);
    }

}

}

Similiar to the above two functions, where I disable fields, I want to disable the ability to add a line item. I do NOT want to lock the whole record (as I am aware I can do from a Workflow), but rather I want to stop users from being able to add/copy/delete Items in the Item sublist.

Was it helpful?

Solution

You can use the validateLine event in your client script to prevent users from adding lines when certain conditions are met. The function you use simply needs to return a Boolean value: true if the line addition can continue, false if it should not.

Similarly, there is a validateDelete event you can use to prevent line removal when certain conditions are met.

Lastly, and also following a similar pattern, there is a validateField event you can use to prevent the user from modifying a field value when certain conditions are met. It is not quite disabling the field, but it will prevent them from changing the value.

Adding these event handler functions to your client script should allow you to prevent the changes you desire, though it does not actually disable any of the fields.

You could use jQuery to disable the Add/Copy/Remove buttons and certain fields, but I doubt that NetSuite would consider that a "supported" approach.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top