Hello Community,
I am working on a project to create a sales order based off of a receipt (RMA) of a shipment. I am relatively new to Acumatica Development side and just had a few questions. I believe I have my action added and code that will create the SO document and I am ready to populate those objects, however, I am unsure on how to reference the data in the shipment record. I essentially need to copy the line items to a sales order with the transfer type. How would I reference the shipment record in the code below? Thanks in advance. I understand the code below may not be accurate, but I am mostly just noodling through this as I learn much better through doing and then fixing my mistakes as I go.
public class SOShipmentEntry_Extension : PXGraphExtension<PX.Objects.SO.SOShipmentEntry>
{
#region Event Handlers
public PXAction<PX.Objects.SO.SOShipment> CreateTransferSO;
PXButton(CommitChanges = true)]
PXUIField(DisplayName = "Create Transfer")]
protected void createTransferSO()
{
SOOrderEntry graph = PXGraph.CreateInstance<SOOrderEntry>();
SOOrder Sorder = new SOOrder();
SOLine sOLine = new SOLine();
Sorder.OrderType = SOOrderTypeConstants.TransferOrder;
Sorder = graph.Document.Insert(Sorder);
sOLine = graph.Transactions.Insert(sOLine);
Sorder.OrderDate = DateTime.Now;
Sorder.RequestDate = DateTime.Now;
Sorder.DestinationSiteID = 900;
graph.Document.Update(Sorder);
graph.Actions.PressSave();
}
#endregion
}
Thanks,
Adam