Skip to main content

Notifications

Microsoft Dynamics GP (Archived)

Cannot find sales invoices created with GP 2013 web service

Posted on by 115

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?

*This post is locked for comments

  • igalindo Profile Picture
    igalindo 55 on at
    RE: Cannot find sales invoices created with GP 2013 web service

    Hola,

    tu registro realmente existe, pero aún no se encuentra en algún estado que lo reconozca gp para poderla mostrar en la consulta que haces. Por decirlo así, aún no está en proceso.

    Si realizas una búsqueda con un Smart list podrás encontrar tu factura.

  • sandipdjadhav Profile Picture
    sandipdjadhav 18,265 on at
    RE: Cannot find sales invoices created with GP 2013 web service

    wow.. I wish I could have remote your computer. If possible to remote then give me call : 210.440.9855.

    Thanks

    Sandip

  • graydryan Profile Picture
    graydryan 115 on at
    RE: Cannot find sales invoices created with GP 2013 web service

    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.

  • sandipdjadhav Profile Picture
    sandipdjadhav 18,265 on at
    RE: Cannot find sales invoices created with GP 2013 web service

    Try it in that and see if system throw any unknow error..!!!

    Thanks

    Sandip

  • graydryan Profile Picture
    graydryan 115 on at
    RE: Cannot find sales invoices created with GP 2013 web service

    Not currently.  I have commented the try catch when i began troubleshooting.

  • sandipdjadhav Profile Picture
    sandipdjadhav 18,265 on at
    RE: Cannot find sales invoices created with GP 2013 web service

    Is your code in Try Catch?

    Thanks

    Sandip

  • graydryan Profile Picture
    graydryan 115 on at
    RE: Cannot find sales invoices created with GP 2013 web service

    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();

                           }

  • Suggested answer
    sandipdjadhav Profile Picture
    sandipdjadhav 18,265 on at
    RE: Cannot find sales invoices created with GP 2013 web service

    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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans