Solved

How to create "LotSerialNbr" By code?

  • 20 January 2021
  • 2 replies
  • 122 views

Userlevel 2

Hello,

I want to know if there are any solution to create the "LotSerialNbr" in SOShipLine By code.

Best regards.

icon

Best answer by jknauf 20 January 2021, 15:49

View original

2 replies

Userlevel 3
Badge

Hello Mohamed,

First off, you shouldn’t think about this as “creating” this field. You could create rows for the table, but I’m pretty sure you want to modify existing data. That field already exists, the value it holds is just null.

Anyway I’d say the first step to doing so would be to determine where you’re going to do this, meaning what graph you’re going to extend. This is important as it defines when your code triggers and what objects/views you have available to you. This should really be dictated by when you want your code to trigger. Generally each screen has it’s own graph, and then you can define event handlers to get more specific as to when this code triggers.

So once you find where you want this code, the next step is getting a reference to the SOShipLine object. Unfortunately how you do this is going to be dependent on the graph you pick, so I can’t just give you the code without knowing it’s context, but I’ll try to give a relatively generic example.

Let’s say you have the variables shipNbr which holds the SOShipLine.ShippmentNbr and line which holds SOShipLine.LineNbr for the record you’d like to change. Your code should look something like this:

// BQL statement to get instance of SOShipLine object
var shipLine = new PXSelect<SOShipLine, Where<SOShipLine.lot.shipmentNbr, Equal<Required<SOShipLine.shipmentNbr>>, And<Where<SOShipLine.lineNbr, Equal<Required<SOShipLine.lineNbr>>>>>>(this.Base).SelectSingle(shipNbr, line);

// Set the value of LotSerialNbr
shipLine.LotSerialNbr = "My lot serial number";


Hopes this helps! Have a happy development!

Userlevel 2

Thank you @jknauf  for your helping, basically the analysis that you do, it works .

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved