Bug theater in Web services #1

imageIf something, Stratus has taught me how buggy the implementation of Web services in Microsoft Dynamics NAV is. Let me be clear from the onset: Web services are a great functionality in NAV, one of the best additions (together with .NET interop) to NAV stack in a long while. But it’s buggy.

Being buggy doesn’t mean it doesn’t work. It only means you need to twist and bend your code to achieve things which you would expect to work out of the box. During development of Stratus, we had to make a series of workarounds in Web services to achieve simple goals, and I decided to share those bugs (and workarounds) with you, to help you be more productive in your Web services based projects.

So, here we go for bug #1: lowercase codes in primary key.

Problem

Check this out:





 

(I assume I don’t need to give details about how to configure the Web reference in C# or how to expose page 21 Customer Card as a Web service called Customer.)

 Now, imagine you write this code in your OnRename trigger in table 18 Customer:

 

Guess what happens?

Well, you get the ‘Gotcha!’ error. Inserting a lowercase value into a code field actually first insert the lowercase value, then renames it to an uppercase value. Pretty cool, eh?

Funny thing – this cannot be done through RTC. OnRename never gets triggered if you insert a lowercase code value to a key field through RTC. This is how Web services should actually behave as well.

Workaround

Not much you can do here. Make sure you uppercase your codes before shipping them over to NAV. RTC seems to do just that.

One thought on “Bug theater in Web services #1”

Let me know what you think

This site uses Akismet to reduce spam. Learn how your comment data is processed.