Thruway2 11/16/2017 12:37:12 PM

Dynamics GP Web Service - Cannot Edit Purchase Order Header Info


I am developing a .NET MVC C# Web Application that uses the Dynamics GP Web Service to help perform tasks like those found in GP. I am working on the Purchase Order feature and need the ability to Create, Read and Update Purchase Orders.

Using the Dynamics GP Web Service, I was able to fairly easily Create a Purchase Order. However, I cannot seem to edit any of its header information. I am using a web form to send the edited data back to the server in the form of a PurchaseOrder object as defined by the Web Service. At first, I thought the form structure may be the culprit but I have since tried simply creating a new PurchaseOrder object right on the Server after I send the request, eliminating any issues with the form. I have tried setting different properties, and leaving others null, but nothing seems to work.

The strangest part, is that I can edit Line item information perfectly fine. When using a web form, the Line data is within the same form as the header info and I have verified that all the expected header information is being passed to the server appropriately.

After my initial attempts failed, I decided to try using eConnect instead of the Dynamics GP Web Service. Because eConnect is actually used behind the scenes, I was expecting eConnect to also fail. However, using eConnect, I was able to edit the header information for an existing PO. This seems to conclude that there is some issue with the Web Service, although I have no idea what it could be.

Below is an example of a simpler test I have tried.

var purchaseOrder = new PurchaseOrder
    CompanyKey = new CompanyKey { Id = 2 },
    Key = new PurchaseTransactionKey { Id = "P0350607" },
    VendorKey = new VendorKey { Id = "00865" },
    BuyerKey = new BuyerKey { Id = "ROC-JENNIFERS" }
var policy = Client.GetPolicyByOperation("UpdatePurchaseOrder", Context);
Client.UpdatePurchaseOrder(purchaseOrder, Context, policy);

This code is within a service method that I have made and normally accepts a PurchaseOrder object. However, to have better control over the data I have chosen to temporarily create a new one within the method. Also, the `Client` object is an instance of the DynamicsGPClient object I have moved into a base class to make using the Web Service a little easier.

In the above example, the BuyerId of the Purchase Order does not change. I have tried similar tests with a variety of other header properties and none of them have ever changed.

Also, the last thing I did was using a SQL Trace. I looked at the RPC:Starting and RPC:Completed events and found that the `taPoHdr` eConnect procedure was being run (if I understand eConnect correctly, this is the correct node for updating a Purchase Order). However, when looking at the command, I could see that all the properties for the xml node were set to `default`. Below is an example. You can see that this command is updating essentially nothing.

I did this same trace while using eConnect directly and the fields I changed were NOT set to default. The changes I had made appeared correctly as they should.

declare @p104 int
set @p104=0
declare @p105 varchar(255)
set @p105=''
exec taPoHdr @I_vPOTYPE=default,
@I_vPONUMBER='P0350607         ',
@I_vVENDORID='00865          ',
@O_iErrorState=@p104 output,
@oErrString=@p105 output
select @p104,

Anyone have any ideas on what I could try to resolve this issue? Anyone experienced anything similar? I could use eConnect if I had to, but I would prefer to use the Web Service.


Version: GP 2010
Section: .NET Development, eConnect, Web Services

Table Definition Quick Links
All Tables
SOP Tables
RM Tables
GL Tables
POP Tables
HR Tables
PM Tables
UPR Tables
IV Tables
Olympic Tables