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 :
Finance | Project Operations, Human Resources, ...
Answered

Error : "Invalid sort field" D365 F&O

(0) ShareShare
ReportReport
Posted on by

Hello Experts,

I have one field on my custom form "ProjectID" which fetches data from a view and  referenced by Projid EDT. on UI side after choosing project ID from drop down , when i am clicking again on Drop Down arrow it shows error Invalid sort field. Please find the screen shot below.

1. Error 

Error89.PNG

2. Field properties in table 

Error90.PNG

3. Projid EDT

Error91.PNG

4. Modified method in DRFProject Table 

Error92.PNG

Please Advise 

I have the same question (0)
  • Blue Wang Profile Picture
    on at
    RE: Error : "Invalid sort field" D365 F&O

    Hi Sachin,

    Have you debugged this? 

    It's same as this thread: community.dynamics.com/.../ax7-invalid-sort-field-message-in-custom-lookup-form

  • Community Member Profile Picture
    on at
    RE: Error : "Invalid sort field" D365 F&O

    Hello Blue , Thank you so much for looking into this issue , I tried debugging but could not find anything  please find the screenshot below. this solution thread belong to AX7 , and not working in  my case. since i am fetching value from View.

    could you please advise anything else.

    Error93.PNG

  • Gunjan Bhattachayya Profile Picture
    35,423 on at
    RE: Error : "Invalid sort field" D365 F&O

    Hi Sachin,

    Which value are you fetching from a view? You mentioned a modified method for the ProjId field. Do you have a lookup method as well?

  • Community Member Profile Picture
    on at
    RE: Error : "Invalid sort field" D365 F&O

    Hello Gunjan , I dont have lookup method for DRF View, As per my knowledge  modifiedField() method work for field lookup also. please refer this link (Link). all the field i  have motioned in  modifiedField()  method i am fetching from view.

    Please correct me if i am wrong in my explanation or i missed something.  

  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at
    RE: Error : "Invalid sort field" D365 F&O

    Hi Sachin,

    I don't think the modified method takes care of the lookup. Since the field has the EDT "ProjId", I believe the ProjTableLookup form is being called here during lookup for the Project Id. You can try debugging the form and check where you are getting the error.

  • Verified answer
    Community Member Profile Picture
    on at
    RE: Error : "Invalid sort field" D365 F&O

    Hello Team, This issue has been solved. this is what i found during my investigation.

    > I found that only for two record which was not sorted, this issue was happening for rest other records it was working fine, so i believe this was due to records incorrect sort. then i was thinking of writing some sort method to sort the record correctly.

    But this is how i solved this issue.

    I removed Projid EDT from table field and write a manual lookup from projtable , below is the lookup method i wrote and this solved my issue.

    [Control("String")]
        class DRFProjectTable_ProjID
        {
            /// 
            ///
            /// 
            public void lookup()
            {
                SysTableLookup sysTableLookup;
                Query query;
                QueryBuildDataSource queryBuildDataSource;
                QueryBuildRange queryBuildRange;
                smmOpportunityTable smmopp;
                query = new Query();
                
                sysTableLookup = SysTableLookup::newParameters(tableNum(ProjTable), this);
                sysTableLookup.addLookupField(fieldNum(ProjTable, ProjId));
                sysTableLookup.addLookupField(fieldNum(ProjTable, Name));
               
    
                queryBuildDataSource = query.addDataSource(tableNum(ProjTable));
        
                
                sysTableLookup.parmQuery(query);
                sysTableLookup.performFormLookup();
            }
    
        }

    Thank you so much Blue and Gunjan for helping me on this issue.

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 753

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 752 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 534 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans