Skip to main content

Notifications

Small and medium business | Business Central, N...
Answered

Print message in multiple line

Posted on by 1,455

Dear folks,

I have come across a situation where I want to print the data in the multiple lines. I have created a field in the Customer card where I have enabled the MultiLine property to enter the data into multiple lines.

Till here it looks fine, but the same when I print from the sales order page, the message shows in single line. 

How can I resolve it?

pastedimage1678866936842v1.png

pastedimage1678866952963v2.png

trigger OnOpenPage()
var
    Customer: Record Customer;
begin
    if Rec."Sell-to Customer No." = '' then
        exit;
    Customer.get(Rec."Sell-to Customer No.");
    if Customer."Customer Message" = '' then
        exit;
    Message(Customer."Customer Message");
end;

PS: I have tried using "\\" also, but it did not work.

  • Suggested answer
    Avinash B Profile Picture
    Avinash B 1,455 on at
    RE: Print message in multiple line

    Thanks all for the suggestions.

    It worked with this code..

    internal procedure ShowCustomerComment()
    var
        Customer: Record Customer;
        TypeHelper: Codeunit "Type Helper";
        CustomerMessages: List of [Text];
        MessageTxt, CustomerMessage : Text;
    begin
        if Rec."Sell-to Customer No." = '' then
            exit;
        Customer.get(Rec."Sell-to Customer No.");
        if Customer."Customer Message" = '' then
            exit;
        CustomerMessages := Customer."Customer Message".Split(TypeHelper.LFSeparator());
        foreach CustomerMessage in CustomerMessages do
            MessageTxt  = '\'   CustomerMessage;
        Message(MessageTxt);
    end;

  • Avinash B Profile Picture
    Avinash B 1,455 on at
    RE: Print message in multiple line

    Hello Nitin,

    Thanks for the suggestion. It works fine if it is a label. But I can not keep the message same because it depends on Customer master.

    I also tried to replace the character (LF or CTLF) from the text to "\\". But it didn't work that way too.

  • Avinash B Profile Picture
    Avinash B 1,455 on at
    RE: Print message in multiple line

    Hi Inge,

    Thanks for the suggestion. But there are certain limitations using it.  

    1. It shows the  "Working on it...." which I don't want.

    2. It closes automatically. Sometimes we can not read the message also.

    So it won't fulfil my requirement.

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: Print message in multiple line

    Hi,

    Can you try below?

    trigger OnAction()

                       var

                           newLable: Label 'This is multiline \ Text availabe in BC';

                       begin

                           Message(newLable);

                       end;

    pastedimage1678868789378v1.png

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,748 Super User 2024 Season 1 on at
    RE: Print message in multiple line

    Instead of using a message box you could look into using a standard dialog page instead with a multiline text box.

    There is a nice video on dialogs in Business Central here:

    www.youtube.com/watch

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,232 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,064 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans