Options in Report Request Page

This posting shows how to add option fields to a report’s request page.

I developed a simple report on base of table Sales Header.

sh-list-1

To filter by field Posting Date you can simply add that field to report data item “Sales Header”‘s property ReqFilterFields, but in this sample we check out how to handle complex filter processing.

Add 2 global variables of type Date: StartDate, EndDate.

sh-list-2

Now edit the request page (Menu View/Request Page), add a container line, a group line and 2 field lines to the request page, set the SourceExpr in line 1 to StartDate, line 2 to EndDate.

sh-list-3

To apply the filter fields add following code to trigger Sales Header – OnPreDataItem.

sh-list-4

If both filter fields are filled, the data is filtered: StartDate<=Posting Date<=End Date.
if only StartDate has a value: StartDate<=Posting Date
if only EndDate has a value: Posting Date<=EndDate

When running the report, we get:

sh-list-5

cheers

 

Check License state of Objects

In Nav forums it’s quite often asked, how to check, if a object is within the current loaded license. There are some solutions for Nav 2009. I did not find a satisfying solution for newer Nav versions. So i’ve developed a “License Permission” Page, which lists Objects and their Permissions. Object IDs, which are not in the current loaded license, means there is no read or execute permission for that Object ID, are displayed red. When running the page the list of all nav objects in the database is loaded.

licperm

The buttons in the page:

licperm2

Reload Base Objects: List all current database Object IDs
Swap Read Filter: Switch between 3 Read Permission Filter settings ” “, Yes|Inherited, No Filter
Swap Execute Filter: same as button above for Execute Permission
Custom Objects Filter: List objects between Object ID 50.000 and 99.999.

licperm3

The object range buttons:

View Table Range: List all table Object IDs according the filter you set.
View Page Range: List all page Object IDs according the filter you set.
View Report Range: List all report Object IDs according the filter you set.
View CU Range: List all codeunit Object IDs according the filter you set.

You can download the page source code here.

The license information is saved in table “License Permission”. With a page on base of that table the windows client freezes, because the data load is really huge, especially, when filtering. So i developed that kind of solution.

cheers

Using mailing groups to send contact mails

In a Nav forum there was the question “How to use Mailing groups to send mails only to Contacts using a specific mailing group”.

I researched a bit, but did not find anything. At the end i found out by try and error, that this can be handled within the Nav Marketing module using Segments.

So let’s start: Create a new mailing group, here i use “Christmas”. Add it to the contacts, which you want to send a christmas card. I set the new mailing group to the first 3 contacts. Check, that each contact has a valid email address. For testing purposes use test mail addresses.

mg10

Create a new segment, set a description and a salesperson code.

mg2
Additional set needed values in tab Interaction. In interaction template code field click on dropdown, select E-MAIL, click Advanced, edit list “Interaction Templates”.

mg12Correspondence Type should be E-Mail. Click on Attachment (Yes or No) to edit the attached word document. Create a christmas card. Save and close word. Attachment field should now be Yes.

Back to Segment Page: Fields Attachment and Correspondence Type should now have values. Set value in Subject. Click “Send Word Docs. as Attmt”, if created word document (christmas card) should be attached to the mail. Not clicking the flag results in copying the text in the word document directly to the mail body (No attachment).

The above steps are needed! I tried to run the whole thing without using attachments. Didn’t work, got an error message: Attachment is needed.

Now click “Add contacts”. There set filter “Mailing group” to “Christmas”.

mg1

In that case 3 contacts are now added.

mg3

According the settings in the Segments Header, especially tabs General and Interaction, values Corr. Type, Description, Salesperson, Interaction Template and Subject are filled automatically in the inserted lines.

Now we are ready to go.

mg11

Click the Log action to send all the christmas mails to the contacts in the list. In the request page click “Send Attachments”. If you want Nav to create a follow-up segment, click the according flag.

mg4

We get then a progress window and a resulting message …

Now the Segment page is closed and the segment record is removed from the segments list. So let’s have a look in the list “Logged segments”.

mg7

There we are. Here you can resend the mails, if needed …

mg13

Additional you can control the interaction by checking the log page. You find the button “Interaction Log entry” in menu tab Navigate. Seems, that emails where sent …

mg14

Nice, but were the mails really sent? Let’s check Outlook …

mg8

This is the Outgoing Folder in Outlook. Yes, it works indeed.😀

cheers

 

 

Dotnet Events are not shown

There are 2 scenarios, where embedded events of .net (dotnet) assemblies can/should be displayed in the c/al code … or maybe not.

Scenario 1:
You use a control-addin like the PingPong Control-Addin (Microsoft.Dynamics.Nav.Client.PingPong). For usage it’s needed that a control-addin is listed in the Control-Addin Page. If so, you can select it from the list, wenn you set a value in property ControlAddin of Page’s field. If the control-addin has embedded events, they should be displayed immediately at the end of the fields triggers in the c/al code.

DisplayEvents3

If not, then

  • the assembly has no events
  • the eventhandling in the assembly was developed not correctly
  • the from the Control-Addin referenced assembly Microsoft.Dynamics.Framework.UI.Extensibility has the wrong version! This assembly is referenced by every Control-Addin. Microsoft ships with each version (build, CU) mostly (always?) new build versions of all the Nav assemblies.

 

Scenario 2:

You declare a global variable of type dotnet and use a .net assembly, which has embedded events. These events are only shown, if you set the variable’s property “WithEvents” to Yes.

DisplayEvents2
If the property is set to No (default), the events are not shown in the c/al code.
if you have set it to true, after that to false, the events stay … for the moment. Compile, re-edit the object and the events in the c/al code are gone.

DisplayEvents1

P.S.: The rumour that the WithEvents property is obsolete, is wrong! It is used in global variables of type dotnet  and is mandatory for the usage of embedded windows events. It was also used in old COM/OCX Components. That one is obsolete in newer Nav versions.

Working with Excel Documents in Nav

nav-xls

Dynamics Nav is shipped with the opportunity to export every report as Excel document. Additional there is Table ExcelBuffer for exporting each kind of data. An example for this table’s usage is the action “Export to Excel” in Page “G/L Budget”.

In table ExcelBuffer there are used some very helpful .net assemblies shipped with Dynamics Nav to cover the interaction with excel.

In Nav forums there are quite often questions about importing or exporting data from/to Excel. So i wrote a sample, where you can see, how to work with these assemblies.

xls1

  • An excel file is opened
  • Adding a new sheet
  • Write a value to the new sheet
  • Close the WorkbookWriter Object to close the current Excel session
  • Open the Excel document in Excel with standard Excel Interop assembly

xls2

The variables: this is the Nav 2013 version, so here is used Microsoft.Dynamics.Nav.OpenXml vs. 7.0. In Nav 2015 use vs. 8.0 instead.

 

Project Madeira: New Videos

blog-microsoft-madeira-screenshot

Solution Systems Inc. has published a couple of videos about Project Madeira.

Overview: https://www.youtube.com/watch?v=BKj3bUd2los

First facts: https://www.youtube.com/watch?v=j5GNX79GLDE

Adding a customer: https://www.youtube.com/watch?v=QxiRLLk7luA

Creating a sales quote: https://www.youtube.com/watch?v=cXlm9jshHOI

Creating a sales order: https://www.youtube.com/watch?v=yam-6JYB_N4

Webinar Overview: https://www.youtube.com/watch?v=l-hvvZ_Fdvo

 

Some additional videos by Theo Kersten:

Sales Quote to Cash: https://www.youtube.com/watch?v=SPeSqmgNLRs

Migrate master data: https://www.youtube.com/watch?v=4TY-maOOaiM