Announcements
I have created a table, with a complex table relation in a field:
Actually I was expecting a standard way of doing it without code, just like when you click the order No. on the Sales Order list, the order card opens up. I guess this only works when there is a ListPage - CardPage relation.
Different scenario but similar requirement. I have a field on the G/L entries to show me the source record name of the posting - so for customer it's the customer name etc. I have a drilldown set on the calculated field and it opens the card page directly based on whichever record it is. Here is some sample code. Might help you.
My field to show the name of the record relating to the G/L entry:
addafter("Source Code") { field("Source Name"; SourceName) { ApplicationArea = All; Caption = 'Source Name'; trigger OnDrillDown() var DataDrillDown: Codeunit "Data Tasks"; begin DataDrillDown.SourceNameDrillDown(Rec."Source Type",Rec."Source No."); end; } }
Doesn't include all the code but it effectively just loops through depending on what the drilldown record relates to and calls a page opening function
procedure SourceNameDrillDown(var RefType: Enum "Gen. Journal Source Type"; var RefCode: Code[20]) var DataRefType: Enum "Gen. Journal Source Type"; Cust: Record Customer; Vend: Record Vendor; Bank: Record "Bank Account"; Empl: Record Employee; FA: Record "Fixed Asset"; begin DataRefType := RefType; case DataRefType of DataRefType::" ": Page.RunModal(0); DataRefType::"Bank Account": begin Bank.Init(); if Bank.Get(RefCode) then GetBankAccountPage(Bank); end; DataRefType::Customer: begin Cust.Init(); if Cust.get(RefCode) then GetCustomerPage(Cust); end; end; end;
page opening function example. So you could create two of these - one for the sales invoice and one for the sales credit memo:
local procedure GetCustomerPage(var Customer: Record "Customer") var CustLookup: Page "Customer Card"; begin CustLookup.Editable := false; CustLookup.SetTableView(Customer); CustLookup.RunModal(); end;
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,186 Super User 2024 Season 2
Martin Dráb 227,996 Super User 2024 Season 2
nmaenpaa 101,148