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.

  • 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
    103,767 Super User 2026 Season 2 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,812 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 727 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 512 Super User 2026 Season 2

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 321 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans