Hello Everyone,
I'm working with a .net solution that calls GP Web Services to return data on existing Purchase Orders. I'm calling GetPurchaseOrderByKey with a specific PO and getting an XML error exception in the Dynamics Web Services Exceptions Console.
The message being returned is: Instance validation error: '' is not a valid value for PurchaseOrderLineOrigin.
I can't seem to retrieve data for any PO or from any of my companies. I'm struggling to understand what field is actually being returned to PurchaseOrderLineOrigin to even troubleshoot this. I have verified that the field LINEORIGIN in POP10110 has values for all line items.
Is it possible a join to a lookup table on those values is breaking or that I'm just missing a setting somewhere?
Thanks in advance!
Here is the code I'm using on button click to make the call. I'm simply trying to display the Vendor Name in a text box for now to prove I'm getting data, but can't get a return.
protected
void
btnGetItems_Click(
object
sender, EventArgs e)
{
CompanyKey companyKey;
Context context;
PurchaseOrder purchaseOrder;
PurchaseTransactionKey purchaseTransactionKey;
// Create an instance of the service
DynamicsGPClient wsDynamicsGP =
new
DynamicsGPClient();
// Create a context with which to call the web service
context =
new
Context();
// Specify which company to use
companyKey =
new
CompanyKey();
//companyKey.Id = (11);
companyKey.Id = (Convert.ToInt32(txtCompany.Text));
// Set up the context
context.OrganizationKey = (OrganizationKey)companyKey;
// Set up Purchase Transaction Key
purchaseTransactionKey =
new
PurchaseTransactionKey();
purchaseTransactionKey.Id = (
"PUR4-0000001"
);
// Retrieve the Purchase Order data.
purchaseOrder = wsDynamicsGP.GetPurchaseOrderByKey(purchaseTransactionKey, context);
txtReturn2.Text = Convert.ToString(purchaseOrder.VendorName);
// Close the service
if
(wsDynamicsGP.State != CommunicationState.Faulted)
{
wsDynamicsGP.Close();
}
}