1

The web service offering for Dynamics GP has a call to CreateSalesInvoice. The problem I'm running into is the call returns void so I don't actually get the sales invoice object after completing the call. I can see the invoice is created in the database and assigned an Id (Key).

From my application I am passing in the values to create the sales invoice and then I want to capture the Id so I can then process a payment against our payment gateway. I want this to all be handled in code. It doesn't seem reasonable to produce a list of invoices by customerId after the user just created the invoice and then have them select the newly created invoice and then process the payment.

Is there a way to get the id after the create method call?

user3075760
  • 23
  • 1
  • 6

1 Answers1

0

To my knowledge the value is not returned via the web service in GP (it's really not a great web service). Since the SOPNUMBE column is the key, your best bet is to generate it in your source, then you know the value when you pass it to GP. You will need to talk to your GP team or review the settings in GP as SOPNUMBE has a 15 CHAR limit. They may want you to configure the number in a specific way like "INV000001".

There is an "ID" field in most GP tables called "DEX_ROW_ID", which is completely useless for 99% of applications as it relates to nothing. Keep in mind that value is not useful to you at all here. You want to use SOPNUMBE and SOPTYPE.

Victoria Yudin's site is extremely helpful in navigating the archaic GP architecture.

https://victoriayudin.com/gp-tables/sop-tables/

Jacob H
  • 2,455
  • 1
  • 12
  • 29
  • I'm hopeful I don't have to "reinvent the wheel" on this one. I see plenty of examples on how to create... I was trying to avoid your suggestion for a couple of reasons. Mainly, since the SOP number for invoices (as you stated) starts with INV and then has some incremental number after it. How can I be sure my number is unique? I have previously looked at Victoria's site and have found it extremely helpful for navigating the table structures. – user3075760 May 17 '17 at 15:24
  • You can query for the next unique value by using the GetNextSOPNumber method https://msdn.microsoft.com/en-us/library/ff623619.aspx then pass the next number to your CreateSalesInvoice call. Like I said, this web service is not really great to work with... – Jacob H May 17 '17 at 15:27
  • Really the problem stems from the fact that GP maintains the next numbers in the sequence in a separate table (since they are not actual database ID values). So you need to call the method to first have GP generate the next sequential invoice number, then pass it to your next call to create the invoice. Again, this all relates to the fact that GP is like 20 years old and doesn't use actual database ID values like most normal applications. – Jacob H May 17 '17 at 15:33
  • thanks for your follow up. I think the age and architecture are what throws me off. I was shocked that the call to create the invoice didn't return the created invoice object. that would solve the problem. I will attempt your suggestion and see what happens. thank you again for staying with the thread. – user3075760 May 17 '17 at 15:52
  • @user3075760 yes it is completely backwards, took me 8 years to get used to it and I'm still figuring out the "intricacies". Please report back with your results! :) – Jacob H May 17 '17 at 15:53
  • looks like the GetNextSOPNumber method is a part of the eConnect offerings and I'm using the web services offerings. Can I setup eConnect connections from my .net project? – user3075760 May 17 '17 at 16:31
  • I attempted your suggestion and added the references to eConnect into my project. I added a method to call GetNextSOPNumber. When I run the code an error. There was no endpoint listening at net.pipe://localhost/Microsoft/Dynamics/GP/eConnect/EntityOperations that could accept the message. Our GP test site is on one server and the database is on a separate one. I can access the web services but the eConnect doesn't seem to work. – user3075760 May 19 '17 at 16:55