GetNewPOHeader Update issue

Hi everyone,

In a data directive, I am getting a new PO Header record, then populating it, then using the Erp.PO.Update method to save the record. However, even though I populate:

  poDS.POHeader[0].Company = "EPIC06";
  poDS.POHeader[0].OpenOrder = true;
  poDS.POHeader[0].VoidOrder = false;
  poDS.POHeader[0].PONum = 0;
  poDS.POHeader[0].EntryPerson = "edi";
  poDS.POHeader[0].OrderDate = "2025-02-02";
  poDS.POHeader[0].FOB = "fob";
  poDS.POHeader[0].ShipViaCode = "FT11";
  poDS.POHeader[0].TermsCode = "CRED";
  poDS.POHeader[0].ShipName = "Main Site";
  poDS.POHeader[0].BuyerID = "Buyer";
  poDS.POHeader[0].VendorNum = 2;
  poDS.POHeader[0].PurPoint = "001";
  poDS.POHeader[0].CommentText = "";
  poDS.POHeader[0].OrderHeld = false;
  poDS.POHeader[0].ReadyToPrint = true;
  poDS.POHeader[0].CurrencyCode = "USD";
  poDS.POHeader[0].OrderNum = 12312;
  poDS.POHeader[0].DueDate = "2025-03-03"; // present - i tried multiple formats and datetime objects for all dates.
  poDS.POHeader[0].PromiseDate = "2025-03-03";

But I’m getting the error:

Supplier Number is required.
Due Date is required.

Any ideas are appreciated. Thank you

Can you trace the network call to see what is being sent to the Update method? Just to check why not everything is where it should be…

1 Like

Thank you for your reply.
Yes, a PurchaseOrderDataSet with a new POHeader record is sent and the fields mentioned are the only fields I populated that are different. I tested exactly this data in the Rest API via the POSvc.POST and it worked.

I haven’t followed the whole trace of creating a new PO, so I wonder if the ChangeVendor method has to be called to set the VenderNum on a new PO…

When you testing this in Rest Helper, did you add a new record or just update an existing?

1 Like

Thank you, I will give this a try.

Yes, I was able to create a POHeader record just by populating the above fields using the Rest API.