Skip to main content

Notifications

Announcements

No record found.

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

Set a default value for the new field type text across the page.

(0) ShareShare
ReportReport
Posted on by 84

Hi

I tried to customize a page by adding a new field with a default value.

How can I do this?

Screenshot-_2800_84_2900_.png

  • Suggested answer
    abhaq5000 Profile Picture
    abhaq5000 15 on at
    RE: Set a default value for the new field type text across the page.

    YUN ZHU

    very good

    Good Job Man

  • Lama Khaled Profile Picture
    Lama Khaled 84 on at
    RE: Set a default value for the new field type text across the page.

    Perfect, Thanks a lot.

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 74,115 Super User 2024 Season 2 on at
    RE: Set a default value for the new field type text across the page.

    Hi, very interesting question. Try the code below.

    tableextension 50111 MyExtension extends "Sales Header"
    {
        trigger OnInsert()
        var
            TypeHelper: Codeunit "Type Helper";
            Crlf: Text[2];
            String: Text[2048];
            OutS: OutStream;
        begin
            Crlf := TypeHelper.CRLFSeparator();
            String := 'This is line 1'   Crlf   'This is line 2'   Crlf   'This is line 3';
            Clear("Work Description");
            "Work Description".CreateOutStream(OutS, TextEncoding::UTF8);
            //OutS.WriteText(textstring);
            OutS.Write(String);
        end;
    }

  • Lama Khaled Profile Picture
    Lama Khaled 84 on at
    RE: Set a default value for the new field type text across the page.

    How I can write more than one line in the Work Description text box by this trigger code?

    I have used this character to make a new line '' but it's not useful.

  • Lama Khaled Profile Picture
    Lama Khaled 84 on at
    RE: Set a default value for the new field type text across the page.

    Thanks so much for the best useful answer.

  • Verified answer
    YUN ZHU Profile Picture
    YUN ZHU 74,115 Super User 2024 Season 2 on at
    RE: Set a default value for the new field type text across the page.

    For example,

  • Lama Khaled Profile Picture
    Lama Khaled 84 on at
    RE: Set a default value for the new field type text across the page.

    Thanks

    How I can use this method?

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 74,115 Super User 2024 Season 2 on at
    RE: Set a default value for the new field type text across the page.

    Hi, the initial value of the BLOB field can only be done using code. As for the method, you can refer to procedure SetWorkDescription in Sales Header.

    Hope this helps.

    Thanks.

    ZHU

  • Suggested answer
    Lama Khaled Profile Picture
    Lama Khaled 84 on at
    RE: Set a default value for the new field type text across the page.

    Hello Mr.ZHU

    Thanks for all your effort when you help us, always you write the best result.

    I have really used the InitValue property but it's not used with the BLOB datatype field.

    It's correct with the Text datatype field but the problem with the Text field is the size of the box to write on it is very small, I need a more large box to write as Blob field " like work description ".

    How I can set default data on the BLOB field? or another way to make the box to write on the Text field larger?

    I wish you can help me!

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 74,115 Super User 2024 Season 2 on at
    RE: Set a default value for the new field type text across the page.

    Hi, hope the following helps.

    How to set the initial value (Automatically set default value for field)

    https://yzhums.com/11876/

    Thanks.

    ZHU

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!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans