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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

Load Cust. Ledger Entries and make changes in field of Customer table.

(0) ShareShare
ReportReport
Posted on by 80

I have one custom boolean field name "SLG Trading Status" in Customer field. I have added startDate and endDate in Cust.Ledger Entry table. I have to fetch out records from Cust. Ledger Entry table if the posting date is between startDate and endDate. If the customer no. has entry in these cust. ledger entries then I have to set 

SLG Trading Status to true else false. 

pastedimage1661530048397v1.png  

So, I have thought of this logic but "

Customer.Get(CustLedgeEntry."Customer No.");

" line has created error. 

pastedimage1661530218045v2.png

If there is any mistake done from my side then please let me know.

I have the same question (0)
  • Suggested answer
    Nitin Verma Profile Picture
    21,698 Moderator on at

    Hi,

    Before customer.get please use cuatomerledgerentry.findfirst and then try

  • Suggested answer
    Amit Baru Profile Picture
    3,037 on at

    hi,

    pls type CustomerLedgerEntry.findfirst

    regards

    Amit Sharma

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,105 Moderator on at

    It is also a bit strange to use the modifyall command in your case, because you will always only update one customer.

    So Customer."SLG Trading Status" : = true;

    Customer.MODIFY(true);

    Would in my option do the code more readable because then you state more clearly that you only modify one customer.

    Using modifyall statement like this will also skip the on modify trigger on the customer table. A bit risky if some other functionality is subscribing to that event.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,990

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,576 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,028 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans