web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

How to Get "Extended text" custom field "TEXT1" data to "purchase order lines " Description

(0) ShareShare
ReportReport
Posted on by

Dear team,

I created a custom field for "Extended Text line" in this scenario because of the character length. so, I set a new length.

   
    field(1018; "Text1"; Text[2000])
    {
        Caption = 'Text1';
    }
Home->Items->Product->Related->Item->Extended Text->New->Extended text lines->(Get the field "Text1").
pastedimage1663840315677v1.png
then activate the "Automatic Ext. Texts" in this below flow,
Home->Items->Product-> ENABLE "Automatic Ext. Texts".
pastedimage1663840845527v2.png
then it is activated to product items and it shows in "Purchase Order lines"
pastedimage1663841301982v3.png
but here showing the default "Text" from "Extended Text Line"
And, My question is how to set the Custom field "Text1" in this area.
Regards,
Nagarjun M - D365 Technical Developer
I have the same question (0)
  • Suggested answer
    Amit Baru Profile Picture
    3,037 on at

    Hi,

    Write code on the event of extended Text and replace Text value to Text1.

    Regards

    Amit Sharma

    www.erpconsultors.com

  • D365 business central development community Profile Picture
    on at

    Hi Amit,

    PO line description also length issue...

    the default BASE code is

    field(11; Description; Text[100])

           {

               Caption = 'Description';

                TableRelation = IF (Type = CONST("G/L Account"), "No." = CONST(''),"System-Created Entry" = CONST(false)) "G/L Account".Name WHERE("Direct Posting" = CONST(true), "Account Type" = CONST(Posting), Blocked = CONST(false))

               ELSE

               IF (Type = CONST("G/L Account"), "System-Created Entry" = CONST(true)) "G/L Account".Name

               ELSE

               IF (Type = CONST(Item), "Document Type" = FILTER(<> "Credit Memo" & <> "Return Order")) Item.Description WHERE(Blocked = CONST(false), "Purchasing Blocked" = CONST(false))

               ELSE

               IF (Type = CONST(Item), "Document Type" = FILTER("Credit Memo" | "Return Order")) Item.Description WHERE(Blocked = CONST(false))

               ELSE

               IF (Type = CONST("Fixed Asset")) "Fixed Asset".Description

               ELSE

               IF (Type = CONST("Charge (Item)")) "Item Charge".Description

               else

               if (Type = CONST(Resource)) Resource.Name;

               ValidateTableRelation = false;

               trigger OnValidate()

               var

                   ApplicationAreaMgmtFacade: Codeunit "Application Area Mgmt. Facade";

                   FindRecordMgt: Codeunit "Find Record Management";

                   ReturnValue: Text[50];

                   IsHandled: Boolean;

                   ShouldErrorForFindDescription: Boolean;

               begin

                   IsHandled := false;

                   OnBeforeValidateDescription(Rec, xRec, CurrFieldNo, IsHandled);

                   if IsHandled then

                       exit;

                   if Type = Type::" " then

                       exit;

                   if "No." <> '' then

                       exit;

                   case Type of

                       Type::Item:

                           ValidateItemDescription();

                       else begin

                               ReturnValue := FindRecordMgt.FindNoByDescription(Type.AsInteger(), Description, true);

                               if ReturnValue <> '' then begin

                                   CurrFieldNo := FieldNo("No.");

                                   Validate("No.", CopyStr(ReturnValue, 1, MaxStrLen("No.")));

                               end;

                           end;

                   end;

                   ShouldErrorForFindDescription := ("No." = '') and GuiAllowed() and ApplicationAreaMgmtFacade.IsFoundationEnabled() and ("Document Type" = "Document Type"::Order);

                   OnValidateDescriptionOnAfterCalcShouldErrorForFindDescription(Rec, xRec, ShouldErrorForFindDescription);

                   if ShouldErrorForFindDescription then

                       Error(CannotFindDescErr, Type, Description);

               end;

           }

    so, I created a new field on PO Lines

    field(1037; Description1; Text[2000])

           {

               Caption = 'Description1';

               TableRelation = IF (Type = CONST("G/L Account"), "No." = CONST(''),

                   "System-Created Entry" = CONST(false)) "G/L Account".Name WHERE("Direct Posting" = CONST(true),

                                                                                   "Account Type" = CONST(Posting),

                                                                                   Blocked = CONST(false))

               ELSE

               IF (Type = CONST("G/L Account"), "System-Created Entry" = CONST(true)) "G/L Account".Name

               ELSE

               IF (Type = CONST(Item), "Document Type" = FILTER(<> "Credit Memo" & <> "Return Order")) Item.Description WHERE(Blocked = CONST(false),

                                                                                       "Purchasing Blocked" = CONST(false))

               ELSE

               IF (Type = CONST(Item), "Document Type" = FILTER("Credit Memo" | "Return Order")) Item.Description WHERE(Blocked = CONST(false))

               ELSE

               IF (Type = CONST("Fixed Asset")) "Fixed Asset".Description

               ELSE

               IF (Type = CONST("Charge (Item)")) "Item Charge".Description

               else

               if (Type = CONST(Resource)) Resource.Name;

               ValidateTableRelation = false;

               trigger OnValidate()

               var

                   ApplicationAreaMgmtFacade: Codeunit "Application Area Mgmt. Facade";

                   FindRecordMgt: Codeunit "Find Record Management";

                   ReturnValue: Text[50];

                   IsHandled: Boolean;

                   ShouldErrorForFindDescription: Boolean;

                   CannotFindDescErr: Label 'Cannot find %1 with Description %2.\\Make sure to use the correct type.', Comment = '%1 = Type caption %2 = Description';

               begin

                   IsHandled := false;

                   OnBeforeValidateDescription(Rec, xRec, CurrFieldNo, IsHandled);

                   if IsHandled then

                       exit;

                   if Type = Type::" " then

                       exit;

                   if "No." <> '' then

                       exit;

                   case Type of

                       Type::Item:

                           ValidateItemDescription();

                       else begin

                           //ReturnValue := FindRecordMgt.FindNoByDescription(Type.AsInteger(), Description, true);

                           if ReturnValue <> '' then begin

                               CurrFieldNo := FieldNo("No.");

                               Validate("No.", CopyStr(ReturnValue, 1, MaxStrLen("No.")));

                           end;

                       end;

                   end;

                   ShouldErrorForFindDescription := ("No." = '') and GuiAllowed() and ApplicationAreaMgmtFacade.IsFoundationEnabled() and ("Document Type" = "Document Type"::Order);

                   OnValidateDescriptionOnAfterCalcShouldErrorForFindDescription(Rec, xRec, ShouldErrorForFindDescription);

                   if ShouldErrorForFindDescription then

                       Error(CannotFindDescErr, Type, Description);

               end;

           }

    FINALLY, I GOT ONE ERROR

    pastedimage1663848926953v1.png

    so, Please help me to fix the issue

    Regards,

    Nagarjun M - D365 Technical Developer

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,965 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,125 Super User 2026 Season 1

#3
Dhiren Nagar Profile Picture

Dhiren Nagar 961 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans