How to Insert a New LotSerial Row in On Save Sales Order Extension — Cloud Customer Connect
You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

How to Insert a New LotSerial Row in On Save Sales Order Extension

Hello,

I’m working on a Sales Order On Save OM extension where I need to manage LotSerial information for order lines. My current goals are:

  1. Update existing LotSerial rows (e.g., set LotNumber, Locator, etc.).
  2. Insert a new LotSerial row if none exists.

Here’s a simplified version of my code for updating:

def lines = header.getAttribute("Lines")
while (lines.hasNext()) {    
 def line = lines.next()      
 def lotSerials = line.getAttribute("LotSerial")     
 while (lotSerials.hasNext()) {          
   def lot = lotSerials.next()             
   lot.setAttribute("LotNumber", "L1")             
   lot.setAttribute("LocatorIdentifier", new BigDecimal("300000310791418"))      
 }
}

This works fine for updating existing LotSerial rows.

However, when I try to 

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!