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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

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

The name "FieldCaption" does not exist in the current context

(0) ShareShare
ReportReport
Posted on by 73

I'm doing the Custom Functions Functions Exercise via Microsoft's Development learning path for manipulating data using code. HEre is the link if you want to visit the page...

Exercise - Custom functions - Training | Microsoft Learn

There is a direction to copy some code and paste in here, but that code creates an error that is difficult to understand. "The name FieldCaption/Credit Limit (LCY) does not exist in the current context."

pastedimage1676655492726v2.png

I have symbols downloaded, but there doesn't seem to be any direct info from Microsoft on how to solve this issue.

I have the same question (0)
  • Suggested answer
    tonyab Profile Picture
    55 on at

    Try doing Rec.FieldCaption("Credit Limit (LCY)")
    You need to have the table in front of the FieldCaption (which in this case would be the Rec variable to indicate the record you are working with). 

  • Suggested answer
    YUN ZHU Profile Picture
    98,356 Super User 2026 Season 1 on at

    Hi, just adding some info.

    If this code is from MS Learn, maybe they forgot to update the program.

    https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-deprecating-with-statements-overview

    Thanks

    ZHU

  • Suggested answer
    Nitin Verma Profile Picture
    21,788 Moderator on at

    Hi,

    You can try as per below

    CreditLimitCalculated := Rec.CalculateCreditLimit();

    if CreditLimitCalculated = Rec."Credit Limit (LCY)" then begin

    Message(CreditLimitUpToDateTxt);

    exit; end; if GuiAllowed() then

    if not Confirm(AreYouSureQst, false, Rec.FieldCaption("Credit Limit (LCY)"),CreditLimitCalculated) then exit;

    CreditLimitActual := CreditLimitCalculated;

    Rec.UpdateCreditLimit(CreditLimitActual);

    if CreditLimitActual <> CreditLimitCalculated then

    Message(CreditLimitROundedTxt, CreditLimitActual);

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,965 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,125 Super User 2026 Season 1

#3
Dhiren Nagar Profile Picture

Dhiren Nagar 961 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans