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):

TEX50100

And adds in on the Posted Sales Shipments page (142):

PEX50100

So, I now have a Box No. field on my Posted Sales Shipments. How do I use it in C/Side?

Method 1

Create an eventpublisher in a C/Side Codeunit or Report and subscribe to it in the extension:

COD50208

COD50100

Now for example add a button on the Posted Sales Shipments Page that calls the Codeunit:

PAG142

And there you go:

MsgBoxFromEvent

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?

Method 2.

Thanks to some old colleagues I have a pretty good working knowledge of RecordRefs and FieldRefs. So, can I use those?

COD50208-FieldRef

And again a call from page 142:

PAG142-FieldRef

And::: (drum-roll please)

MsgBoxFromFieldRef

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.

Method 3.

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:

BoxNoInForNAV

So, there it is. I added the BoxNo field to the report and when printing this is the result:

REP50208-ForNAVResult

Final notes

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.

About the Author René Brummel

My driving force is the will to learn. Every day brings its unique challenges, my goal is to rise to each challenge and learn from it. My professional expertise is the streamlining and optimization of business processes. My experience ranges from software development (I know AL, C/AL, C#, .NET, Visual Basic etc) and implementation to business processes optimization, project management, training, and coaching. At the heart of what I do lies my vision, “sustainable change comes from conscious choice, made out of free will”. In my spare time I am a member of Bikers Against Child Abuse. B.A.C.A. helps abused children to no longer be afraid of the world in which they live.

3 comments

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s