Following is theway how you can source Receive By Date from Purchase Order to the Item Recordvia scripting. It will help in keeping track of when a particular item would bereceived.
1.Create a Custom Item Field. Navigate to Customization >Lists, Records, & Fields > Item fields > New
- Label: Receive Date (for instance)
- Type: Date
- Store Value: Checked
- Applies To: Inventory Item
2.Create a User Event Script with the following code:
var receiveDate=nlapiGetFieldValue('duedate'); //get theReceive by Date of Purchase Order
var noOfItems= nlapiGetLineItemCount('item'); //Count thenumber of items in the PO
for (var i = 1; i <= noOfItems; i++ ) //Loop througheach item
var itemid=nlapiGetLineItemValue('item','item',i); //Get the internal id of the item record
var itemrecord =nlapiLoadRecord('inventoryitem', itemid); //Load the item record
itemrecord.setFieldValue('custitem15',receiveDate); //Set the value of Custom entity field created in step 1.(Note :replace 'custitem15' with the internal ID of the custom item field created instep 1 )
nlapiSubmitRecord(itemrecord); //Save the itemrecord
3.Navigate to Customization > Scripting > Scripts > New
Type: User Event
4.Upload the Script File.
5.Click Save and Deploy
On the Script Deploymentpage
- Applies To: Purchase Order
- Status: Testing (until released)
Now,as soon as you save a Purchase Order, the script will trigger and set theReceive Date of each item from the Purchase Order.
Note:The above script will set the Receive Date of an item from its latest PurchaseOrder
DISCLAIMER: The sample code described herein isprovided on an "as is" basis, without warranty of any kind, to thefullest extent permitted by law. Netsuite Inc. does not warrant or guaranteethe individual success developers may have in implementing the sample code ontheir development platforms or in using their own Web server configurations.
NetsuiteInc. does not warrant, guarantee or make any representations regarding the use,results of use, accuracy, timeliness or completeness of any data or informationrelating to the sample code. Netsuite Inc. disclaims all warranties, express orimplied, and in particular, disclaims all warranties of merchantability,fitness for a particular purpose, and warranties related to the code, or anyservice or software related thereto.
NetsuiteInc. shall not be liable for any direct, indirect or consequential damages orcosts of any type arising out of any action taken by you or others related tothe sample code.
Post a Comment