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

What is difference between setautocalcfields & calcfields in business central?

(0) ShareShare
ReportReport
Posted on by 153
Hi Guys,
 
What is difference between setautocalcfields & calcfields in business central? 
and when we can used setautocalcfields or calcfields?
 
I have the same question (0)
  • Suggested answer
    Tech-Lucky Profile Picture
    1,288 Moderator on at

    in the case of CALCFIELDS, each FlowField results in a separate query that is not good for performance if you are using this inside the loop.

    The SETAUTOCALCFIELDS is one of the improvements in NAV / BC you should make use of. Any REPEAT … UNTIL loop that contains CALCFIELDS within the loop can benefit from this function. Just set a SETAUTOCALCFIELDS before the FINDSET and all FlowFields you have defined will be calculated with one SELECT command.

    How does that work? Very simple: the SETAUTOCALCFIELDS automatically updates the SELECT query with JOINS for each FlowField. So one query with all your FlowFields calculated.

    the conclusion is SETAUTOCALCFIELDS improves system performance.

    Please verify my answer if this was helpful.

  • Suggested answer
    Teddy Herryanto (That NAV Guy) Profile Picture
    14,306 Super User 2026 Season 1 on at
    SetAutoCalcFields is basically CalcFields on looping.
    You use SetAutoCalcFields before looping to increase the performance of your code, so the server knows that it needs to retrieve the value while calling the records.
     
    // Using CALCFIELDS
    IF Customer.FINDSET THEN
    REPEAT
      Customer.CALCFIELDS(Balance,"Net Change");
      … // Do some additional processing.
    UNTIL Customer.NEXT = 0;

    // Using SETAUTOCALCFIELDS for performance
    Customer.SETAUTOCALCFIELDS(Balance,"Net Change");
    IF Customer.FINDSET THEN
    REPEAT  
      … //Do some additional processing.
    UNTIL Customer.NEXT = 0;
  • Suggested answer
    YUN ZHU Profile Picture
    100,061 Super User 2026 Season 1 on at

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!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,825 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 967 Super User 2026 Season 1

#3
Teagen Boll Profile Picture

Teagen Boll 652 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans