Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

Dynamics GP: Inserted value not get at GP font end

(0) ShareShare
ReportReport
Posted on by

Using Web Service for Dynamics GP 2013 and Creating Sales Invoice by following code:

   CompanyKey companyKey;

  Context context;

   SalesInvoice salesInvoice;

   SalesDocumentTypeKey salesInvoiceType;

   CustomerKey customerKey;

   BatchKey batchKey;

   SalesInvoiceLine salesInvoiceLine;

   ItemKey invoiceItem;

   Quantity invoiceCount;

   Policy salesInvoiceCreatePolicy;

   MoneyAmount unitPrice;

   DynamicsGPClient wsDynamicsGP = new DynamicsGPClient();

   context = new Context();

   companyKey = new CompanyKey();

   companyKey.Id = (-1);

   context.OrganizationKey = (OrganizationKey)companyKey;

   salesInvoice = new SalesInvoice();

   salesInvoice.Key = new SalesDocumentKey();

   salesInvoice.Key.Id = this.CreateId(); //"XX555";

   salesInvoiceType = new SalesDocumentTypeKey();

   salesInvoiceType.Type = SalesDocumentType.Invoice;

   salesInvoice.DocumentTypeKey = salesInvoiceType;

   customerKey = new CustomerKey();

   customerKey.Id = "ADAMPARK0001";

   salesInvoice.CustomerKey = customerKey;

   batchKey = new BatchKey();

   batchKey.Id = "SALES INVOICES";

   salesInvoice.BatchKey = batchKey;

   salesInvoice.Comment = "Test invoice master comments.";

   IList<SalesInvoiceLine> salesInvoiceLines = new List<SalesInvoiceLine>();

   string[] itemId = { "ACCS-HDS-1EAR", "32X IDE" };  

   for (int i = 0; i < itemId.Count(); i++)

   {

       salesInvoiceLine = new SalesInvoiceLine();

       invoiceItem = new ItemKey();

       invoiceItem.Id = itemId[i];

       salesInvoiceLine.ItemKey = invoiceItem;

       unitPrice = new MoneyAmount();

       unitPrice.Currency = "USD";

       unitPrice.DecimalDigits = 2;

       unitPrice.Value = 1.00M;

       salesInvoiceLine.UnitPrice = unitPrice;

       invoiceCount = new Quantity();

       invoiceCount.Value = 1 + i;

       salesInvoiceLine.Quantity = invoiceCount;

       salesInvoiceLine.ItemDescription = "test Item Description q1 " + i;

       salesInvoiceLine.Comment = "test Item comment q1 " + i;

       salesInvoiceLines.Add(salesInvoiceLine);

   }

   SalesInvoiceLine[] invoiceLines = salesInvoiceLines.ToArray();

   salesInvoice.Lines = invoiceLines;

   salesInvoiceCreatePolicy = wsDynamicsGP.GetPolicyByOperation("CreateSalesInvoice", context);

   wsDynamicsGP.CreateSalesInvoice(salesInvoice, context, salesInvoiceCreatePolicy);

   if (wsDynamicsGP.State != CommunicationState.Faulted)

   {

       wsDynamicsGP.Close();

   }

This code little bit changed from this example

Invoice created and data inserted into table:

1882.gp-_2D00_-Copy.png

Created invoice doesn't visible or show at anywhere of GP font end. How and Where will found it?

*This post is locked for comments

  • Almas Mahfooz Profile Picture
    Almas Mahfooz 11,006 User Group Leader on at
    RE: Dynamics GP: Inserted value not get at GP font end

    Tim I assumed if he can create invoice from web service then he should also know where to look in GP.

    Mr. Khalid, your sop number field is exceeding the sop number storage length and so could not be display on GP.

    Limit your sop number ID to 17 characters as see if you are able to view it or not.

  • Verified answer
    Tim Foster Profile Picture
    Tim Foster 8,515 on at
    RE: Dynamics GP: Inserted value not get at GP font end

    Transactions >> Sales >> Sales Transaction Entry  

    Change Document Type to Invoice (Dropdown)

    Use Document Number Lookup  to find it.

    Tim

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,430 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans