Skip to main content

Notifications

Community site session details

Community site session details

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

how to modify values in a custom field in Res. Ledger entry

(2) ShareShare
ReportReport
Posted on by 22
Hi everyone,
I created a new field called TestField in the table Res. Ledger entry.
Is there a way to modify the value in TestField via a procedure? For example I could create an action on the Resource Ledger Entries page which for each record in the table Res. Ledger entry copies the Entry No. to the TestField.
 
Thank you and best regards
  • gnlca Profile Picture
    22 on at
    how to modify values in a custom field in Res. Ledger entry
    it worked!
    Thank you!
  • Verified answer
    Mohamed Amine Mahmoudi Profile Picture
    23,902 Super User 2025 Season 1 on at
    how to modify values in a custom field in Res. Ledger entry
    Hi @gnlca,
    You're right. 
    In that case I suggest you create a codeunit and add a permission set (Permissions = TableData "Res. Ledger Entry" = RMID) to it.
    pageextension 50109 "Resource Ledger Entries Ext" extends "Resource Ledger Entries"
    {
        layout
        {
            addafter("Entry Type")
            {
                field(TestField; Rec.TestField)
                {
                    ApplicationArea = All;
                }
            }
        }
    
        actions
        {
            addbefore("&Navigate")
            {
                action(PopulateTestField)
                {
                    ApplicationArea = All;
    
                    trigger OnAction()
                    var
                        test: Codeunit Test;
                    begin
                        test.UpdateTestField(Rec."Entry No.");
                    end;
                }
            }
        }
    }
    
    Codeunit
    codeunit 50105 Test
    {
        Permissions = TableData "Res. Ledger Entry" = RMID;
    
        procedure UpdateTestField(EntryNo: Integer)
        var
            ResLedgerEntry: Record "Res. Ledger Entry";
        begin
            if (ResLedgerEntry.Get(EntryNo)) then begin
                ResLedgerEntry.TestField := ResLedgerEntry."Entry No.";
                ResLedgerEntry.Modify();
            end;
        end;
    
    }
    Best regards,
    Mohamed Amine MAHMOUDI
  • gnlca Profile Picture
    22 on at
    how to modify values in a custom field in Res. Ledger entry
    Hi Mohamed,
    the code you proposed I already tried myself but it fails because the table Res. Ledger Entry is read only.
    The key is to make either the field TestField write enable and/or to catch the system method that is preventing my code to modify the value.
     
    Thank you and best regards,
     
  • Mohamed Amine Mahmoudi Profile Picture
    23,902 Super User 2025 Season 1 on at
    how to modify values in a custom field in Res. Ledger entry
    Hi @gnlca,
     
    Yes you can flow these steps :
    1 Table Extension (Res. Ledger Entry)
    tableextension 50109 "Res. Ledger Entry Ext" extends "Res. Ledger Entry"
    {
        fields
        {
            field(50100; TestField; Integer)
            {
                Caption = 'Test Field';
                DataClassification = ToBeClassified;
            }
        }
    }
    2 Page extension (Resource Ledger Entries)
    pageextension 50109 "Resource Ledger Entries Ext" extends "Resource Ledger Entries"
    {
        layout
        {
            addafter("Entry Type")
            {
                field(TestField; Rec.TestField)
                {
                    ApplicationArea = All;
                }
            }
        }
    
        actions
        {
            addbefore("&Navigate")
            {
                action(PopulateTestField)
                {
                    ApplicationArea = All;
    
                    trigger OnAction()
                    var
                        ResLedgerEntry: Record "Res. Ledger Entry";
                    begin
                        if (ResLedgerEntry.Get(Rec."Entry No.")) then begin
                            ResLedgerEntry.TestField := ResLedgerEntry."Entry No.";
                            ResLedgerEntry.Modify();
                        end;
                    end;
                }
            }
        }
    }
    Best regards,
    Mohamed Amine MAHMOUDI

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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 1,452

#2
YUN ZHU Profile Picture

YUN ZHU 1,313 Super User 2025 Season 1

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 1,083 Most Valuable Professional

Featured topics

Product updates

Dynamics 365 release plans