Implementing Mandatory Fields

Implementing Mandatory Fields In Navision

Probably this is the feature most missing from Navision. As a record is instantly saved when it's primary key is populated, it's almost impossible to make fields mandatory. There are simply no perfect solutions for this problem. Some of the wrong ones I managed to come up with are discussed here.

Managerial control

Set important fields red. Create a report that shows records that have missing fields, f.e. :
(OnPreSection trigger)
Global variables:
ShowRecord - Boolean
ErrorText: Text - 1024
Global Text Constants:
Text001: "is missing."

If Description='' then begin
ErrorText+= FIELDCAPTION(Description) + ' ,';

If "Unit Price"=0 then begin
ErrorText+= FIELDCAPTION("Unit Price") + ' ';
ErrorText+= Text001;

Then tell managers to massacre people with a two-handed battleaxe or with a chainsaw on steroids if this report ever shows any records :-)

Pros: only slight change to standard objects.
Cons: dangerous, because it still does not enforce filling in important data.

Implement a workflow
Set important fields red. Create a new Boolean field called Confirmed. Put all checking in the OnValidate of that field (TESTFIELD this, TESTFIELD that). Tell users to check this boolean field and don't give until they manage it.

For ALL related Orders and Journals, check whether the master data record is Confirmed with a TESTFIELD in the OnValidate trigger.



Sales Header, Sell-To Customer No., Bill-To Customer No.General Journal Line, Account No. and Bal. Account No. if Account Type / Bal. Account Type = Customer


Purchase Header, Buy-From Vendor No., Pay-To Vendor No.General Journal Line, Account No. and Bal. Account No. if Account Type / Bal. Account Type = Vendor

Sales Line, No. if Type=Item
Purchase Line, No. if Type=Item
Transfer Line, Item No.
Prod. Order Line, Item No.
Prod. Order Component Line, Item No.
Item Journal Line, Item No.
Warehouse Journal Line, Item No.
Warehouse Activity Line, Item No.

Pros: very effective, forbids basically all transactions with a master data record that is not filled perfectly.

Cons: a lot of modification, harder to upgrade.

Create a Wizard
You can also try creating a wizard, where the user enters data in variables and it gets programatically saved when the users pushes a button.

Pros: does not modify standard objects.
Cons: hell of a lot work to do.

Create another kind of wizard
Setup the master data in a way that the No. Series is TEMPCUST0001, TEMPCUST0002... Have the user press a button that performs all the checks and then changes the No. to some other, sane thing.

Pros: it's easy.
Cons: What if so dimwit happily enters an order for TEMPCUST001, without pressing that button?

Create yet another kind of wizard
Save the master data table to another number. The form too. Create a button that performs the validations and then transfers data to the real tables with a simple TRANSFERFIELDS.

Pros: very elegant and simple, and does not modify the standard objects.Cons: The client needs to buy a lot of tables - and what about subtables (Item Unit of Measure etc.) ?

Use the built-in wizards
Have Customers and Vendors created through Contacts and put all important fields in Customer Templates and Vendor Templates. Have all Items created through Non-Stock Items and add important fields to Nonstock Item Card, and put code to check them and transfer them to Items in Codeunit Nonstock Item Management, function NonStockAutoItem.

Pros: It's easy.
Cons: modifies standard objects. The client needs to buy granules that otherwise might be unnecessary.

Do it the simple way
Pat users on the shoulder and say in a jovial voice: "Don't worry, my friends, it's but a year or two and you will get accustomed to what fields you need to fill..." and THEN prepare to run in zig-zag when they draw a shotgun... :-)

UPDATE: Jacob's idea
Set the form to DelayedInsert. Add checkings to OnInsert.

My opinion: very good, but also add a Save button with an INSERT(TRUE); to avoid confusing users - it might be hard for them to understand why they need to navigate to the next record to insert this one.

Jubel Thomas

{picture#} Having 9+ years of Dynamics NAV Experience with Modules like Finance, Sales, Manufacturing, Warehouse, Purchase, Human Resource etc. Also know LS retail, Dynamics AX, Business Intelligence. {facebook#} {twitter#}

Contact Form


Email *

Message *

Powered by Blogger.