Bug theater in Web services #5

  • Post category:Development
  • Post comments:0 Comments
  • Reading time:3 mins read

My daughter Ema, born January 16th 2012Last Monday I’ve attended my second daughter’s birth, and then spent the week trying to relieve my wife as much as possible from anything but breastfeeding.

As a matter of fact, I’d like to keep doing it, it was not only a great break from daily worries, but also a fantastic occasion to spend all the time available with my closest and dearest, which I am not sure when I will have next.

It seems that there is life to keep going on, so I’ll now try to be back with my work and my blog.

Let me introduce bug #5: fields within a FixedLayout control.

Problem

If you have Field controls under a Group of type FixedLayout, at any nesting sub-level, such Field controls wouldn’t be accessible through Web services.

It’s simple to repeat: just publish page 151 Customer Statistics as a web service, and you can see that only the fields belonging to the first group (General) are visible in the WSDL, while any fields from Sales group are not present.

Microsoft has confirmed this problem, but as far as I know, no hotfix has been released to fix this specific issue yet.

Workaround

You can argue that there is no need to access Statistics pages through Web services, so this might seem not a big problem after all. However, this is not only about Statistics pages – it is about any kind of pages where FixedLayout is used, and another example is Journals.

For example, you might want to know if your journal balances to 0 before posting – if fields in FixedLayout would be accessible, it would be a simple task. Without it, you have to keep track of it outside NAV, which means that you must implement all NAVs logic about document numbers, balancing accounts, etc.

In any case, there is no straightforward way to access those fields. The workaround we used is to simply create a new group, make it invisible, and re-add all the fields present under a FixedLayout there. This makes all the data in a page accessible to Web services consumers, while hiding them from front-end users (to avoid confusion).

There is a trick here – because hiding something from front-end users is not as simple as setting the Visible property to FALSE. This would still enable users to show it through Customize This Page functionality. But since this has nothing to do with this specific issue, I’ll blog about it when I get to Web services Tips & Tricks part of this series. For now, let’s keep talking about bugs and workarounds.

Vjeko

Vjeko has been writing code for living since 1995, and he has shared his knowledge and experience in presentations, articles, blogs, and elsewhere since 2002. Hopelessly curious, passionate about technology, avid language learner no matter human or computer.

Leave a Reply