Business Central CU06 TearDown - minor update

I was in middle of changing workplace, so I did not post about CU05 changes, sorry about that to all my faithful readers. The CU05 is well worth a blog post, it had quite some changes that require commenting, so perhaps I will write about that in a later phase.
Now I work at Solteq Oyj, and have again had some time to blog about the latest changes in Business Central. If you want to check my new company's web pages, just click here!
When I went through the ChangeLog this time, I had some nostalgic moments when I noticed that MS has fixed some things that really have not been bugs, but minor nuisances with NAV deliveries. I listed the changes below for your convenience. This time the post also contains couple of code samples from ChangeLog that I think are worth sharing.

Document Headers

Document headers have two changes worth mentioning here. First is Work Description handling changes and second is IsCreditDocType helper function.

Work Description handling

Sales Header (And other headers that have Work Description field) used to have a nice feature (From BC CU05 which I did not post about...) how to convert OEM decoded text into UTF-8. It used TryFunction and Streams first to check if the text is in UTF-8, and if not then use Streams to convert it from Windows to UTF-8. This is now removed. I add the code here for reference just in case someone needs to do such conversions. I know I will be using this later ;)
Call for TryFunction:
//call to TryFunction
    BEGIN
      IF NOT "Work Description".HASVALUE THEN
        EXIT('');
      IF NOT TryReadWorkDescriptionWithUTF8Encoding THEN
        ChangeEncodingToUTF8;
      CR[1] := 10;
      TempBlob.Blob := "Work Description";
      EXIT(TempBlob.ReadAsText(CR,TEXTENCODING::UTF8));
TryFunction:
//TryFunction
    [TryFunction]
    LOCAL PROCEDURE TryReadWorkDescriptionWithUTF8Encoding@300();
    VAR
      InStream@1000 : InStream;
      TempText@1001 : Text;
    BEGIN
      "Work Description".CREATEINSTREAM(InStream,TEXTENCODING::UTF8);
      InStream.READ(TempText);
    END;
And finally ChangeEncoding function to convert Windows encoded text to UTF-8:
//and ChangeEncoding function
    LOCAL PROCEDURE ChangeEncodingToUTF8@301();
    VAR
      InStream@1001 : InStream;
      OutStream@1002 : OutStream;
      TempText@1003 : Text;
    BEGIN
      "Work Description".CREATEINSTREAM(InStream,TEXTENCODING::Windows);
      InStream.READ(TempText);
      CLEAR("Work Description");
      "Work Description".CREATEOUTSTREAM(OutStream,TEXTENCODING::UTF8);
      OutStream.WRITE(TempText);
      MODIFY;
    END;

IsCreditDocType

Some time ago MS added a new helper function to sales and purchase related tables, IsCreditDocType. The use of this helper function is now expanded to more fields where it is relevant to know if the document type is incoming or outgoing.

Other changes

Other changes include some random picks from the changelog, and some new fields that are added to the tables. These are always interesting!

Item.Sales Blocked and Item.Purchase Blocked

I have somehow missed these BC new fields altogether. Well, these have been checked when the item is purchased or sold, and this CU brings possibility to use sales or purchase blocked items on return orders and credit type documents.

Table 1432 Net Promoter Score Setup

This table now has all fields classified as SystemMetaData. There is also a new field where user can set timeout value; Field 5 Request Timeout.
There is also new functions to set default timeouts for CacheLifeTime, RequestTimeOut and also a function that returns how many milliseconds there is in a minute.
umm...

Table 5741 Transfer Line

Finally MS added here two very much needed keys that I can now drop from my "Standard Changes" list. New keys are:
    {    ;Transfer-to Code,Receipt Date,Item No.,Variant Code }
    {    ;Transfer-from Code,Shipment Date,Item No.,Variant Code }


Codeunit 32000002 Bank Nos Check (FI localization)

This codeunit has a nice function that can be used whenever developer needs to check if some string contains something else than numbers. The approach MS has used here is very similar to what I have done earlier to make sure that Finnish payment reference number does not contain letters. This is quite common scenario, since standard NAV data has letters in customer numbers, and reference payment no uses customer no as a part of the payment reference - and payment reference cannot contain
any letters!
This issue has been discussed many times in different forums, but this approach is in my opinion most elegant:
ReferenceNumber := DELCHR(PostingNo,'=',DELCHR(PostingNo,'=','0123456789'));

Clear Clutter -initiative

MS continues clearing clutter by removing direct buttons on Sales and Purchase documents to delete invoiced documents, and has moved these page actions to list pages.
This is nice.
This is about all this time, have a nice Easter!
Comment List
Anonymous
Related
Recommended