Skip to main content
Business Central forum
Suggested answer

Add the value of a new custom field to another related table

editSubscribe (2) ShareShare
ReportReport
Posted on by 30
Hi,
I have added a custom field called Item Description to the item table as the current Description field is too short

I want the value of this field to show  (that was entered in the item card page) in the Blanket Purchase Order when I select an item


I can get it to show as a Flow field but I don't want this as it needs to be editable.  I just want to show this new field in the same way as the currrent Description shows.

Any help appreciated. Tried some trigger OnAfterGetRecord() code in the page extension of the Blanket Purchase Order but didn't work
Categories:
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 59,926 Super User on at
    Add the value of a new custom field to another related table
    Personally, I do not recommend this customization because there are too many tables related to Item Description.
    Even if you add new fields and add this function to Blanket Purchase Order, only these two places are available, and the standard Item Description will still be displayed in other features. 
    In addition, this is also related to the posting code. If you assign a value of length 500 to a field of standard length 100, an error will be prompted or the first 100 characters will be automatically taken.
     
    As for the problem you mentioned, you can refer to the following way.
     
    Thanks
    ZHU
     
  • Yasas Profile Picture
    Yasas 53 on at
    Add the value of a new custom field to another related table
    In Business Central, there is a feature for extended descriptions in the Item card. I suggest you try that function to see if it fulfills your requirements.


    Best Regards,
    Yasas.
  • Community member Profile Picture
    Community member 30 on at
    Add the value of a new custom field to another related table
    Got it to work. Is there anything I am missing?  Description 2 is only 50 characters
     
    addafter("Item No.")
            {
                field("Item Description KGS"; Rec."Item Description KGS")
                {
                    ToolTip = 'Item Description';
                    ApplicationArea = all;
                }
            }
    trigger OnAfterGetRecord()
        begin
            SetMyStyle();
            
            Desc.reset;
            Desc.SetRange("No.", Rec."Item No.");
            If Desc.FindFirst() then begin
                rec."Item Description KGS" := Desc."Item Description KGS";
            end;

        end;

        procedure SetMyStyle()
        begin
            if (rec."Item Status KGS" = 'Risky') then
                Mystyle := 'Unfavorable' else
                Mystyle := 'Standard';
        end;

        var
            MyStyle: Text;
            Desc: Record "Item";
  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 45,235 Super User on at
    Add the value of a new custom field to another related table
    I would suggest you to use standard Description 2 field if you are not already using so you dont have to do any development.
     
     
    Back to your question :)
     
    The Item field values are copied to purchase line in a CopyFromItem function of Table 39
    You can subscribe to OnAfterAssignItemValues event/publisher and update your field.
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    Mohamed Amine Mahmoudi 3,513 UG Leader on at
    Add the value of a new custom field to another related table
    Hi,
     
    I think you use OnValidate trigger to populate your new custom field.
     
    for old records you need to create a few code to update the new field.
     
    Best regards,
    Mohamed Amine MAHMOUDI

Helpful resources

Quick Links

What Motivates a Super User?

We know many of you visit the Dynamics 365 Community and Power Platform…

Demystifying Copilot with Georg Glantschnig…

Industry experts answer burning questions directly from our amazing Community…

Setting Up Knowledge Sources for Copilot…

Look at how configuring a comprehensive knowledge base is crucial…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,045 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 222,570 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,138

Product updates

Dynamics 365 release plans