Friday, August 21, 2020

#bcopendiscussion - Dummy Extension for Print Custom Report From Purchase Order.

 Hi Readers,

This article is originated from one of our weekly #bcopendiscussion. This article talks about a concept you can enhance this extension the way you wanted. 

I have two other way that I can handle it, so feel free to add your views in the GitHub repo. 

If you find this useful please thanks  Shahid Ullah.


The discussion question was - 

I like to replace the existing Purchase Order Report with my Developed Purchase Order Report using the below condition-

I have added a filed Order Type and Value is say 1,2,3

If Order Type 1 then like to call Custom PO report ID-50001

If Order Type 2 then like to call Custom PO report ID-50002

If Order Type 3 then like to call Custom PO report ID-50003

Here is how I thought would be simple extension for it -

1. Add a Field in Purchase Header Table and Purchase order Page.

Using Table Extension add a field & using page extension add field in General Tab.

** Just for Demo I am using SDH Prefix/Suffix.

2. Add a Codeunit To Subscribe Event from Table Report Selection.

Check it is purchase order or not. If its not purchase order then exit otherwise call customize report.

3. Add Reports that you need. 

For Demo I just copied base Microsoft Report and saved in 5000 Numbers.

4. Test Process, Check Purchase order and check with Order Type = ''.

5. Test Process, Check Purchase order and check with Order Type = option2.

If you find this useful, or would like to enhance this please feel free to download / contribute using GitHub repo.

GitHub Link -

If you are still in C/AL please download objects from here. OneDrive Link

Source code is developed using Business Central 14. You can branch out and download symbol to test it. When you will try to download symbol system will generate launch.json.

Let me know your views on same.

Saurav Dhyani