Friday, September 21, 2018

Know if a Purchase Order is a Drop Ship PO uisng SuiteScript

A NetSuite user would like to know how to determine if a Purchase Order is a Drop Ship Purchase Order or not.

The customer could use a field on the Purchase Order record called dropshipso. This field contains the internal ID of the Sales Order record where the PO was created from. The User Event script sample below will differentiate Drop Ship POs and Special Order POs. 


function determineDropShipPOs(type) {
     if (type == 'create') {
         var createdFrom = nlapiGetFieldValue('createdfrom');
         var dropShipSO = nlapiGetFieldValue('dropshipso');

         if (createdFrom != '' || createdFrom != null) {
             if (dropShipSO != '' || dropShipSO != null) {
                 nlapiSetFieldValue('custbody_isdropshippo', 'T');
             } else {
                 nlapiSetFieldValue('custbody_isspecialorderpo', 'T');
             }
             return true;
         } else {
             return true;
         }
     }
 }

custbody_isdropshippo is a checkbox transaction body field applied which indicates that the record is a Drop Ship Purchase Order.

Meanwhile, custbody_isspecialorderpo is a checkbox transaction body field which indicates that the record is a Special Order Purchase Order.

Deploy script on the Before Submit function of a Purchase Order.


DISCLAIMER: The sample code described herein is provided on an"as is" basis, without warranty of any kind, to the fullest extentpermitted by law. Oracle + NetSuite Inc. does not warrant or guarantee theindividual success developers may have in implementing the sample code on theirdevelopment platforms or in using their own Web server configurations.

Oracle +NetSuite Inc. does not warrant, guarantee or make any representations regardingthe use, results of use, accuracy, timeliness or completeness of any data orinformation relating to the sample code. Oracle + NetSuite Inc. disclaims allwarranties, express or implied, and in particular, disclaims all warranties ofmerchantability, fitness for a particular purpose, and warranties related tothe code, or any service or software related thereto.

Oracle + NetSuite Inc. shall notbe liable for any direct, indirect or consequential damages or costs of anytype arising out of any action taken by you or others related to the samplecode.

No comments:

Post a Comment