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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

How to create a link (action) from an item card to another card page and paste some value ?

(0) ShareShare
ReportReport
Posted on by 20

Hi,

I'm new in programming in AL ( and programming in general )

I have created a page to save some value related to an item (TDS Card)

page 95121 "TDS Card"
{
    PageType = Card;
    SourceTable = "TDS";

    layout
    {
        area(content)
        {
            group("SPECIFICATION DU PRODUIT")
            {
                field("Ingrédients"; Rec."Ingrédients") { ApplicationArea = All; MultiLine = true; }
                field("Allergènes"; Rec."Allergènes") { ApplicationArea = All; }
                field("OGM"; Rec."OGM") { ApplicationArea = All; }
                field("Ionisation"; Rec."Ionisation") { ApplicationArea = All; }
                field("DLC"; Rec."DLC") { ApplicationArea = All; }
                field("Conservation"; Rec."Conservation") { ApplicationArea = All; MultiLine = true; }
                field("Utilisation/préparation"; Rec."Utilprép") { ApplicationArea = All; MultiLine = true; }
                field("Législation"; Rec."Législation") { ApplicationArea = All; }
                field("Remarques"; Rec."Remarques") { ApplicationArea = All; MultiLine = true; }
            }
            group("CARACTERISTIQUE ORGANOLEPTIQUE DU PRODUIT")
            {
                field("Article"; Rec."Article")
                {
                    ApplicationArea = basic;

                    trigger OnLookup(var Text: Text): Boolean
                    var
                        ItemRec: Record Item;
                    begin
                        ItemRec.Reset();
                        if Page.RunModal(Page::"Item List", ItemRec) = action::LookupOK then Rec.Article := ItemRec."No.";
                    end;
                }
                field("Odeur"; Rec."Odeur") { ApplicationArea = All; }
                field("Couleur"; Rec."Couleur") { ApplicationArea = All; }
                field("Saveur"; Rec."Saveur") { ApplicationArea = All; }
            }
        }
    }
}

The page is working fine but i want to link the card directly from my item card

pastedimage1681286919074v1.png

So i would like to create an option called "TDS" on main item card page that will open (or create if not exist) the new card (page 95121) and directly past the value N° "F00002" in this example to the field "Article"

In my table the field "Article" is the PK

Thanks a lot for your help.

Phil the newbie  ;-)

I have the same question (0)
  • Suggested answer
    Govinda Kumar Profile Picture
    2,308 Moderator on at

    Hi Neodep,

    You need to create an action and in that action, you have to run your new card (page 95121) and add the page link like this

    pastedimage1681297575578v1.png
    In your case

    RunObject = page "TDS Card";
    RunPageLink = Article = field(Article);

    Regards

  • Neodep Profile Picture
    20 on at

    Hi Kumar,

    Sorry but i'm totally new in developping AL

    I need to create an extension ( extends "item card")  or include the code in the page "TDS card"

    Is it possible to have the full code ?

    Thank a lot.

  • Verified answer
    Govinda Kumar Profile Picture
    2,308 Moderator on at

    Hi Neodep,

    you need to create an extension in the "Item card" page, here is some custom code you can use as a starting point, but be sure to modify it to meet your specific needs

    pageextension 50100 MyExtensionItemCard extends "Item Card"
    {
        actions
        {
            addafter(AdjustInventory)
            {
                action(TDS)
                {
                    Image = GetSourceDoc;
                    ApplicationArea = All;
                    Promoted = true;
                    PromotedCategory = Process;
                    PromotedIsBig = true;
                    PromotedOnly = true;
                    Caption = 'TDS Card Action';
                    RunObject = page "TDS card";
                    RunPageLink = Article = field(Article);
                }
            }
        }
    }

    Remember to specify where you want to add your action in the page. In the above code, I have added it after the 'AdjustInventory'.

    I also recommend you to update your page type to 'CardPart'

    Regards

  • Neodep Profile Picture
    20 on at

    Hi Kumar,

    I undesrtand more now.. thanks for the code.

    Its working at 80% now.

    The last problem is when i click on an item that dont have yet value associated in "TDS Card", it doesnt created automaticaly when i open from the new link that you just helped me to create and i need to click on + from the card page and put the value from the field "No." from the "Item Card".

    Then i open again the "TDS Card" from the new menu then its working.

    Do you think is there a possibility to populate automatically the field "Article" with the field No. from Item card if the PK in table "TDS card" dont exists yet ?

    Thanks a lot for your help.

    pastedimage1681303661654v1.png

  • Neodep Profile Picture
    20 on at

    And this is the code i have updated to create the link in Item card page

    pageextension 95122 MyExtensionItemCard extends "Item Card"
    {
        actions
        {
            addafter(AdjustInventory)
            {
                action(TDS)
                {
                    Image = GetSourceDoc;
                    ApplicationArea = All;
                    Promoted = true;
                    PromotedCategory = Process;
                    PromotedIsBig = true;
                    PromotedOnly = true;
                    Caption = 'TDS Card Action';
                    RunObject = page "TDS card";
                    RunPageLink = Article = field("No.");
                }
            }
        }
    }

  • Suggested answer
    Govinda Kumar Profile Picture
    2,308 Moderator on at

    Hi Newdep,

    I don't understand your question. Could you please send me the primary keys of your TDS table?

    What I recommend is adding two primary keys to your TDS table, one is the Article with relation Item table of "No." and the second is RecNo, with a data type of integer and set to auto-increment. This should help with automatically populating the field 'Article' with the 'No.' field from the Item card, if the primary key in the TDS table does not exist yet.

    regards

  • Neodep Profile Picture
    20 on at

    For instance, the Primary Key is only the field "Article" in the table "TDS"

    I use the same value from the Item card table "No."

    I think i understand what you mean about 2 keys but i have absolutely no idea on what i can do this.

  • Neodep Profile Picture
    20 on at

    Here is the code of the table

    table 95120 "TDS"
    {
    
        fields
        {
            field(1; "Article"; Code[20]) { }
            field(10; "Ingrédients"; Text[250]) { }
            field(11; "Allergènes"; Text[150]) { }
            field(12; "OGM"; Text[150]) { }
            field(13; "Ionisation"; Text[150]) { }
            field(14; "DLC"; Text[150]) { }
            field(15; "Conservation"; Text[250]) { }
            field(16; "Utilprép"; Text[250]) { }
            field(17; "Législation"; Text[250]) { }
            field(18; "Remarques"; Text[250]) { }
            field(30; "Odeur"; Text[50]) { }
            field(31; "Couleur"; Text[50]) { }
            field(32; "Saveur"; Text[50]) { }
        }
    
        keys
        {
            key(PK; "Article") { }
    
        }
    }

  • Suggested answer
    Govinda Kumar Profile Picture
    2,308 Moderator on at

    table 95120 "TDS"
    {
    
        fields
        {
            field(1; "Article"; Code[20]) { }
            field(10; "Ingrédients"; Text[250]) { }
            field(11; "Allergènes"; Text[150]) { }
            field(12; "OGM"; Text[150]) { }
            field(13; "Ionisation"; Text[150]) { }
            field(14; "DLC"; Text[150]) { }
            field(15; "Conservation"; Text[250]) { }
            field(16; "Utilprép"; Text[250]) { }
            field(17; "Législation"; Text[250]) { }
            field(18; "Remarques"; Text[250]) { }
            field(30; "Odeur"; Text[50]) { }
            field(31; "Couleur"; Text[50]) { }
            field(32; "Saveur"; Text[50]) { }
            field(33; "RecID"; Integer) { AutoIncrement = true; }
        }
    
        keys
        {
            key(PK; "Article","RecID") { }
    
        }
    }

    Here is how you can add it
    Regards

  • Verified answer
    Govinda Kumar Profile Picture
    2,308 Moderator on at

    Why not add the table relation in field 1 "Article"

    field(1; "Article"; Code[20]) { TableRelation = Item."No."; }

    regards

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,334 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,717 Super User 2026 Season 1

#3
AndrewThomas81 Profile Picture

AndrewThomas81 1,470

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans