Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Adding a field to Sales Price and Line Discounts as an AL Extension is not showing in Business Central

Posted on by 90

Hello,

I am trying to add a field to the Sales Price and Line Discounts page which is on the Customer Page.  I am wanting to add the Item Description to the list page.  I have a local copy of NAV installed on my machine, NAV 2018, and I can get the field to show up there when I install the extension.  But when I try to install it to BC, the field will never show up.  Has anyone had this issue?  I feel like I'm not doing anything different than in the past to adding a field to a list page. I've tried to do it as a flow field and as a physical field and neither show up.  I understand that the Sales Price and Line Discounts uses a temp table so maybe that is the issue.  This is the first time I've had to deal with temp tables in an Extension.  Here is my code:

pageextension 50121 SalesPriceandLineDiscountsCBIZ extends "Sales Price and Line Discounts"
{
    layout
    {
        addafter("Unit of Measure Code")
        {
            field("Item Description"; "Item Description")
            {
                ApplicationArea = Suite;
                Caption = 'Item Description';
            }
        }
    }

    actions
    {
        // Add changes to page actions here
    }

    var
        myInt: Integer;

    trigger OnAfterGetRecord();
    var
        Item: Record Item;
    begin
        if Rec.Type = Rec.Type::Item then begin
            Item.SetRange("No.", Code);
            if Item.FindFirst then begin
                Rec."Item Description" := Item.Description;
                Rec.Modify;
            end;
        end;

    end;
}

tableextension 50121 SalesPriceLineDiscBuffCBIZ extends "Sales Price and Line Disc Buff"
{
    fields
    {
        field(50100;"Item Description";Text[50])
        {

        }
    }
    
    var
        myInt : Integer;
}


pageextension 50121 SalesPriceandLineDiscountsCBIZ extends "Sales Price and Line Discounts"
{
layout
{
addafter("Unit of Measure Code")
{
field("Item Description"; "Item Description")
{
ApplicationArea = Suite;
Caption = 'Item Description';
}
}
}

actions
{
// Add changes to page actions here
}

var
myInt: Integer;

trigger OnAfterGetRecord();
var
Item: Record Item;
begin
if Rec.Type = Rec.Type::Item then begin
Item.SetRange("No.", Code);
if Item.FindFirst then begin
Rec."Item Description" := Item.Description;
Rec.Modify;
end;
end;

end;
}

*This post is locked for comments

  • gnilsen Profile Picture
    gnilsen 90 on at
    RE: Adding a field to Sales Price and Line Discounts as an AL Extension is not showing in Business Central

    Stephano, thank you so much for being patient with me.  What I found is that I was using 1345 (Sales Price and Line Discounts) and what I needed to use was 1347 (Sales Pr. & Line Disc. Part).  I used the inspect page.  I never knew that you could click on the page to see the pages of the page parts.  I never had done that.  So I clicked on the Page part in the Customer Card record and found out what page it was.  Thanks so much for directing me in the right direction.  I learned something today.

  • Suggested answer
    Stefano Demiliani Profile Picture
    Stefano Demiliani 37,162 Most Valuable Professional on at
    RE: Adding a field to Sales Price and Line Discounts as an AL Extension is not showing in Business Central

    The standard page that shows Sales Prices under the Customer Card is called Sales Prices (ID = 7002).

    Please open the desired page, then select ? and click on Page Inspector. Here you can see the exact name and ID of the page you want. This is only to be sure that you're modifying the correct page.

  • gnilsen Profile Picture
    gnilsen 90 on at
    RE: Adding a field to Sales Price and Line Discounts as an AL Extension is not showing in Business Central

    I believe the Sale Price and Line Discounts page is the correct page.  It is a page part on the Customer Card.  It is in the Group called Statistics and it is a part under that Group.  It just seems really weird that I can't get a field to show up on this page part.

  • Suggested answer
    Stefano Demiliani Profile Picture
    Stefano Demiliani 37,162 Most Valuable Professional on at
    RE: Adding a field to Sales Price and Line Discounts as an AL Extension is not showing in Business Central

    Are you sure that the page name is correct? Try using page inspector and check if this is the exact page where you want the fields to appear.

    Nornally the Sales Prices page is called ""Sales Prices" and not "Sales Price and Line Discounts".

    If instead it's the exact page that you want, your code is correct and the field should appear.

  • gnilsen Profile Picture
    gnilsen 90 on at
    RE: Adding a field to Sales Price and Line Discounts as an AL Extension is not showing in Business Central

    So I still am having problems with this.  I am currently in a Sandbox environment. What I did was use the exact same code with the Item Ledger Entry and the Sales Price and Line Discounts pages.  It works in Item Ledger Entry but not in the Sales Price and Line Discount page.  Any ideas why this doesn't work in the Sales Price and Line Discounts page? Here is my exact code:

    pageextension 50101 ItemLedgerEntriesCBIZ extends "Item Ledger Entries"
    {
        layout
        {
            addafter("Item No.")
            {
                field(ItemDescriptionCBIZ; ItemDescriptionCBIZ)
                {
                    ApplicationArea = All;
                    Caption = 'Item Description';
                    Visible = true;
                }
            }
        }
    
        actions
        {
            // Add changes to page actions here
        }
    
        var
            myInt: Integer;
    }
    
    tableextension 50101 ItemLedgerEntryCbiz extends "Item Ledger Entry"
    {
        fields
        {
            field(50100; "ItemDescriptionCBIZ"; Text[50])
            {
                FieldClass = FlowField;
                CalcFormula = lookup (Item.Description where ("No." = field ("Item No.")));
    
            }
            modify("Item No.")
            {
                trigger OnAfterValidate()
                begin
                    CalcFields(ItemDescriptionCBIZ);
                end;
            }
        }
    
        var
            myInt: Integer;
    }
    
    pageextension 50100 SalesPriceandLineDiscountsCBIZ extends "Sales Price and Line Discounts"
    {
        layout
        {
            addafter("Ending Date")
            {
                field(ItemDescriptionCBIZ; ItemDescriptionCBIZ)
                {
                    ApplicationArea = All;
                    Caption = 'Item Description';
                    Visible = true;
                }
    
    
            }
    
        }
    
        actions
        {
            // Add changes to page actions here
        }
    
        var
            myInt: Integer;
    
        trigger OnAfterGetRecord();
        begin
        end;
    
    }
    
    tableextension 50121 SalesPriceLineDiscBuffCBIZ extends "Sales Price and Line Disc Buff"
    {
        fields
        {
            field(50100; "ItemDescriptionCBIZ"; Text[50])
            {
                FieldClass = FlowField;
                CalcFormula = lookup (Item.Description where ("No." = field (Code)));
    
            }
            modify(Code)
            {
                trigger OnAfterValidate()
                begin
                    CalcFields(ItemDescriptionCBIZ);
                end;
            }
        }
    
        var
            myInt: Integer;
    }
  • Suggested answer
    Stefano Demiliani Profile Picture
    Stefano Demiliani 37,162 Most Valuable Professional on at
    RE: Adding a field to Sales Price and Line Discounts as an AL Extension is not showing in Business Central

    Are you in an online sandbox? ApplicationArea is the only thing that handles visibility (obviously, apart from Visible = true/false).

  • gnilsen Profile Picture
    gnilsen 90 on at
    RE: Adding a field to Sales Price and Line Discounts as an AL Extension is not showing in Business Central

    Thanks for the reply.  I tried ApplicationArea=All and that didn't make it show either:

    This is what it still looks like after installing the extension in BC.

    2867.Capture2.PNG

    This is what it looks like in NAV 2018:

    2867.Capture2.PNG

    Any other ideas?  

    I appreciate your help.

  • Suggested answer
    Stefano Demiliani Profile Picture
    Stefano Demiliani 37,162 Most Valuable Professional on at
    RE: Adding a field to Sales Price and Line Discounts as an AL Extension is not showing in Business Central

    Use ApplicationArea = All.
    P.S. filling the field in OnAfterGetRecord trigger of a page is a bad programming pattern :) Use table or field trigger instead.

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 Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans