Tuesday, March 12, 2019

Access Item records on Sales Order using Client Script in Customer Center

These instructions allow you to access fields on the item records of items on a sales order using a client script.  Trying to reference one directly will generate a permission error related to "Lists -> Items". It isn't possible to give a Customer Center role permission to view Item records so instead create a hidden Customer Transaction Column field and then reference that.

1. Create a custom field. Customization > Lists, Records, & Fields > Transaction Column Field

   -For the Type select the Type for the field you want to reference in your script.  Eg for Date Created use the Type Date.

  -In the Sourcing & Filtering tab set Source List = Item and then set Source From equal to the field you want to reference in your script (Eg Date Created)

  -In Display tab set Display Type = Hidden

  -Save

2. Reference the new custom field in your client script. Example where custbody1 is the internal id of the field created in step 1:

var record = nlapiLoadRecord('salesorder', nlapiGetRecordId());
var rec = record.getLineItemValue('item','custcol1',1);



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

Netsuite Inc. does not warrant, guarantee or make any representations regarding the use, results of use, accuracy, timeliness or completeness of any data or information relating to the sample code. Netsuite Inc. disclaims all warranties, express or implied, and in particular, disclaims all warranties of merchantability, fitness for a particular purpose, and warranties related to the code, or any service or software related thereto.

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