Customizing Dynamics NAV
Discover different ways to customize the application to give you and your colleagues access to the features, functionality, and data that you need most.
Dynamics 365 2019 release wave 2 plan Discover the latest updates to Dynamics 365.Release Plan | Weekly Deployment Notes
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants.Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements.
ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Talent TechTalks
Generally speaking, enabling huge text fields in NAV is bad design because it encourages dumping unstructured data into the system. Reason Codes is an example of adding useful, structured data to the system.
But, every once in a while, there’s a legitimate need to write up a large chunk of text. The Notes functionality isn’t bad for that, but try adding that to a Report or a FastTab.
When that need comes along, you can do it natively now using the built-in RTC tools. I’m using a case scenario for a company that performed contractual maintenance tasks for their customers and they needed a free-text place to enter information about the work done each site visit that would then print on a report.
Their interface for it looks like so:
Work Description is their internal notes. Work Performed is their potentially customer facing information. We’ll talk about that. Just to show it off, here’s how it looks as you enter chunks of data:
First, you need a place for the data to live.
We’ll create it as a BLOB, but there’s a handy SubType we’ll want to set called Memo.
For universal access to the functions we’ll need, two public Functions are just the thing.
SetWorkPerformed sets the value of the blob from a Text (size unlimited) variable using TempBlob’s handy “WriteAsText” function.
GetWorkPerformed does the reverse, returning the raw BLOB text as Text using the TempBlob’s ReadAsText function. That’s it, though you’ll notice we have a couple things in there dealing with Line Feeds and Text Encoding, so you may have to adjust those based on your regional/platform needs.
Now, the page is pretty simple.
We need Global Text Variables:
We also need to add the controls to the Page:
To get the layout I showed above, I use nested Groups to add the Captions above the Field, rather then to the left, widening the control to a more TextArea style appearance. Then, the Variable fields get a couple key Properties:
We also need our equivalent of Setters and Getters. You can refactor this to Eventing if you want – this customer was on a version that had limited support for it.
First, we have to fetch the values to the Variable. When the page loads a record, we populate the Text variables with our Record’s function.
Then on the Field itself, during OnValidate(), we need to write the info back:
Same as the Page. Use your Getter to load a Text variable, then add that to the Report’s Data model. That simple.
Bear in mind there will still be limits to this field – it’s a BLOB, so you have to jump through hoops to work with the contents. If someone asks if you can filter on it, the answer is “No*”. You could provide a really, really slow MARKED(TRUE); search function that could scan through them, but start with no. If it’s something that needs to be filtered or searched on, it should be structured data.
Hopefully this helps some of you.
Business Applications communities