Commands for Adding Detail Lines

When you need to add a detail line to an MYOB Acumatica form, you can use one of the following approaches:
  • Add detail lines one by one on the Details tab of the form. For example, on the Sales Orders (SO301000) form, you can click Add Row on the Details tab and specify the values of the elements of each detail line.
  • Add detail lines by using a pop-up panel. For example, on the Shipments (SO302000) form, you can use the Add Sales Order pop-up panel, which is opened when you click Add Order on the table toolbar of the Details tab.

In this topic, you will find the description of the NewRow command, which imitates the first approach listed above in the screen-based API. The second approach is described in Commands for Pop-Up Panels.

NewRow Service Command

When you are specifying the sequence of commands in an array of Command objects for a processing method and you need to add a new detail line to a document, you should use commands as follows:
  1. To add a new row, use the NewRow service command, which is an available service command of the Details subobject of a Content object.
  2. To specify the values of the elements of the created row, use the Value commands corresponding to the elements.
The following code shows an example of an order line being added to a sales order.
//orderSchema is an SO301000Content object 
var commands = new Command[]
{
    ...
    orderSchema.DocumentDetails.ServiceCommands.NewRow,
    new Value 
    {
        Value = "AALEGO500", 
        LinkedCommand = orderSchema.DocumentDetails.InventoryID 
    },
    new Value 
    {
        Value = "10.0", 
        LinkedCommand = orderSchema.DocumentDetails.Quantity 
    },
    new Value 
    {
        Value = firstItemUOM, 
        LinkedCommand = orderSchema.DocumentDetails.UOM 
    },
    ...
}