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

Community site session details

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

Cannot call SetAscending on field Bill-to Customer No.

(1) ShareShare
ReportReport
Posted on by 102
I am getting the error “Cannot call SetAscending on field Bill-to Customer No. because it is not part of the current sorting.” when trying to use SetAscending. How can I correctly sort by this field?
I have the same question (0)
  • Verified answer
    Sahan Hasitha Profile Picture
    1,849 on at
    Cannot call SetAscending on field Bill-to Customer No.
    hi 
    try this
  • Verified answer
    Sahan Hasitha Profile Picture
    1,849 on at
    Cannot call SetAscending on field Bill-to Customer No.
    hi
     
    The error appears because in AL, you can only call SetAscending on a field that is already part of the current key of the record. To fix this, you must first call SetCurrentKey with the field you want to sort on, and then apply SetAscending.

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

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

#1
Nimsara Jayathilaka. Profile Picture

Nimsara Jayathilaka. 3,180

#2
Sumit Singh Profile Picture

Sumit Singh 3,063

#3
YUN ZHU Profile Picture

YUN ZHU 2,317 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans