So, I get it now. We need to develop in extensions. Nothing but extensions. We need to tell our employers to forget about new requirements for half a year and ignore bugs while we developers lock ourselves in the basement and rework our existing code to an extension. Right?
Well, locking developers in a basement will probably appeal to a fair number of managers. Not developing new requirements or fixing bugs for said amount of time will definitely not. Like it or not, many of us face working with hybrid systems.
Where I work we now have extensions in a heavily modified C/Side code base. So when my Colleague phoned me a while back to ask me how in hell he could get a field from our extension onto a C/Side report I had to put my thinking cap on.
So far I came up with three workable methods of getting extension data into C/Side.
For demo purposes I created a simple extension that adds a Box Number field to the Posted Sales Shipment Header (110):
And adds in on the Posted Sales Shipments page (142):
So, I now have a Box No. field on my Posted Sales Shipments. How do I use it in C/Side?
Create an eventpublisher in a C/Side Codeunit or Report and subscribe to it in the extension:
Now for example add a button on the Posted Sales Shipments Page that calls the Codeunit:
And there you go:
Big downside here of course is that you have to generate symbols. Which is a right royal pain in the backside. So, without symbols and events?
Thanks to some old colleagues I have a pretty good working knowledge of RecordRefs and FieldRefs. So, can I use those?
And again a call from page 142:
And::: (drum-roll please)
So, well, that was, well, easy. Of course you would need to add a few checks to see if the field exists. Just in case someone uninstalls your extension.
Have I mentioned it gets easier? Well, I have been working with the great people at ForNAV for a while now. Since they use the fields web service to determine the Dynamics NAV data set perhaps the ForNAV designer can see the extension field without mucking about in
hyperspace C/Side. So I converted report 208 to ForNAV and opened the designer:
So, there it is. I added the BoxNo field to the report and when printing this is the result:
Thanks for reading this far. If you have anything to add or know of a better way please let me know. Of course all the objects and the extension are found on GitHub. All objects are provided without warranty. Try them at your own risk.
Full disclosure, ForNAV do pay me to do webinars and other stuff. I love the product because it is awesome. That is why I write about it. Try it, you will not be disappointed.
6 thoughts on “Three ways to use extension data in C/Side”
Reblogged this on Mark Brummel Blog | Microsoft Dynamics NAV.
LikeLiked by 1 person
Congrats, again, with a very usefull article!
LikeLiked by 1 person
I have a problem passing a blob field. Can’t use this method. Any suggestion?
What is the problem with blob fields? Can’t see an issue.