I have a WCF application using c# that consumes the GP 2013 web service. Using the sample code from the Web Reference guide, I am able to execute CreateSalesInvoice method without receiving any exceptions, but cannot locate the invoice in the GP thick client. I checked Sales -->Receivables Transactions, Sales --> All Sales Transactions, and Sales --> Invoicing Transactions, but cannot find any trace of the transaction.
I am able to see the results of other method calls, just not CreateSalesInoice.
Any ideas?
Are you sure there was no error while creating Sales Invoice? In WebService check Company ID is -1 or different.
Check your company master with below query.
select * from SY01500
Let me know how it goes?
You may check web service exception on web service server.
Thanks
Sandip
Thanks for the response Sandip. I am using CompanyId -1 for the Sample company. I ran the query that you provided, and i see 1 record with CompanyId -1.
The exception console does not show any errors or warnings.
I had originally edited my code, but have since scaled it back to the original example from reference guide:
CompanyKey companyKey;
Context context;
SalesInvoice salesInvoice;
SalesDocumentTypeKey salesInvoiceType;
CustomerKey customerKey;
BatchKey batchKey;
SalesInvoiceLine salesInvoiceLine;
ItemKey invoiceItem;
Quantity invoiceCount;
Policy salesInvoiceCreatePolicy;
// Create an instance of the service
DynamicsGPClient wsDynamicsGP = new DynamicsGPClient();
// Create a context with which to call the service
context = new Context();
// Specify which company to use (sample company)
companyKey = new CompanyKey();
companyKey.Id = (-1);
// Set up the context object
context.OrganizationKey = (OrganizationKey)companyKey;
// Create a sales invoice object
salesInvoice = new SalesInvoice();
// Create a sales document type key for the sales invoice
salesInvoiceType = new SalesDocumentTypeKey();
salesInvoiceType.Type = SalesDocumentType.Invoice;
// Populate the document type key for the sales invoice
salesInvoice.DocumentTypeKey = salesInvoiceType;
customerKey = new CustomerKey();
string customerResult = string.Empty;
customerKey.Id = "AARONFIT0001";
// Set the customer key property of the sales invoice
salesInvoice.CustomerKey = customerKey;
// Create a batch key
batchKey = new BatchKey();
batchKey.Id = "SALES INVOICES";
// Set the batch key property of the sales invoice object
salesInvoice.BatchKey = batchKey;
// Create a sales invoice line to specify the invoiced item
salesInvoiceLine = new SalesInvoiceLine();
// Create an item key
invoiceItem = new ItemKey();
invoiceItem.Id = "32X IDE";
// Set the item key property of the sales invoice line object
salesInvoiceLine.ItemKey = invoiceItem;
// Create a sales invoice quatity object
invoiceCount = new Quantity();
invoiceCount.Value = 2;
// Set the quantity of the sales invoice line object
salesInvoiceLine.Quantity = invoiceCount;
// Create an array of sales invoice lines
// Initialize the array with the sales invoice line object
SalesInvoiceLine[] invoiceLines = { salesInvoiceLine };
// Add the sales invoice line array to the sales line object
salesInvoice.Lines = invoiceLines;
// Get the create policy for the sales invoice object
salesInvoiceCreatePolicy = wsDynamicsGP.GetPolicyByOperation("CreateSalesInvoice", context);
// Create the sales invoice
wsDynamicsGP.CreateSalesInvoice(salesInvoice, context, salesInvoiceCreatePolicy);
// Close the service
if (wsDynamicsGP.State != CommunicationState.Faulted)
{
wsDynamicsGP.Close();
}
Is your code in Try Catch?
Not currently. I have commented the try catch when i began troubleshooting.
Try it in that and see if system throw any unknow error..!!!
I've tried that as well. I intentionally changed a variable to an invalid value to force an exception. That worked and the exception was thrown as expected. When i change the variable back to a valid value, no exception, no result.
wow.. I wish I could have remote your computer. If possible to remote then give me call : 210.440.9855.