Saturday, March 9, 2019

Prevent Adding an Expense if Location or Department is Blank through Client SuiteScript

The following sample client script prevents the user from adding an expense line item on the expense report if location OR department is BLANK:

 

function clientValidateField(type, name, linenum){

  

       var myloc = nlapiGetCurrentLineItemText('expense', 'location');

       var mydept = nlapiGetCurrentLineItemText('expense', 'department');

      

       if(mydept == ''|| myloc == '')

       {

              alert('please enter a value for department or location');

              return false;

       }

       else

       {

              //do stuff

       }

    return true; 

}

 

Disclaimer: The above sample requires working knowledge in SuiteScript. 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