I've searched through as many forum posts here as I could find and none of them quite match the issue I am having
My company has an ERP application that we have integrated with GP in order to send invoices from our application over to GP and post them there.
We are using the web service to accomplish this and our application is a windows forms app. So the problem I am having is that we want to change the company in GP we are sending the invoices to, and so I was told by the previous developer that the service reference to the web service would need to be deleted and recreated to reflect the company Id change.
So I changed the company Id in the app.config file for our project, and then removed and recreated the service reference to the GP web service.
I am now receiving the following error when trying to call any of the getByKey methods (like GetCustomerByKey):
Microsoft.Dynamics.Security.NonExistentSecurityObjectException : The security object does not exist. Key = 0
And here is the xml from the call to the web service:
<?xml version="1.0"?> <RequestObjects> <CustomerKey xmlns:xsd="www.w3.org/.../XMLSchema" xmlns:xsi="www.w3.org/.../XMLSchema-instance"> <Id>12000</Id> </CustomerKey> <Context xmlns:xsd="www.w3.org/.../XMLSchema" xmlns:xsi="www.w3.org/.../XMLSchema-instance" xmlns="schemas.microsoft.com/.../01"> <OrganizationKey xsi:type="CompanyKey"> <Id>0</Id> </OrganizationKey> <CultureName>en-US</CultureName> <CurrencyType>Transactional</CurrencyType> <TenantName /> </Context> <string>Microsoft.Dynamics.GP.Customer</string> </RequestObjects>
....
It appears as though a 0 is being sent as the company key ID, which is obviously wrong. Does anyone have any insight on some step I might be missing? Or maybe some better instructions on adding the service reference for the GP web service within Visual Studio?
EDIT: I also wanted to point out that I can see the correct company Id being passed into the web service call via the context when calling something like this: this.WSDynamicsGP.GetCustomerByKey(gpCustomerKey, this.Context);
*This post is locked for comments