Text.TOUPPER

I’ve added a field to the Sales Shipment Line. Whatever the user types in this field I want to convert to upper case as soon as the user is done (the same standard NAV does with some fields like External Doc field on Sales Orders).

I’m using Extensions 2.0 and NAV 2018.

  1. Should the code to do the conversion be in Table extension or the Page extension?
  2. How do I get the value the user entered to pass to Text.TOUPPER?

// Table extension
field(50001;VehicleRegNo;Text[10])
{
trigger OnValidate();
begin
// code here``` end; }`

// Page extension
field(ShipmentNo;ShipmentNo)
{
CaptionML = ENU='Shipment Ref No';

trigger OnValidate();
begin
// code here ``` end; }`

Hi Links,

To answer your second question first. You should never write any code in PageExtensions or Pages for that matter. Only code here should be to change the UI. And no matter if we talk field triggers, functions etc. [emoticon:c4563cd7d5574777a71c318021cbbcc8]

So you should put the code in the field trigger in the table extension. And you can use this code:

VehicleRegNo := UpperCase((VehicleRegNo);

Thanks Erik. I really appreciate your guidance.

The only documentation I could find for the UpperCase function is here - https://docs.microsoft.com/en-us/previous-versions/dynamicsnav-2009/dd301373(v=nav.60)

This states that it is a C/AL function. Are all C/AL functions automatically AL functions as well?

Hi Links,

Well most of them are, plus a lot more. You should look in the NAV 2018 / Business Central AL reference.

https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-al-reference-guide

And uppercase is found here: https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods/devenv-uppercase-method-code-text

But often it’s much faster to use the Intellisense in Visual Studio Code.