Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Filter records in list page D365 Operations

(1) ShareShare
ReportReport
Posted on by 1,027

Hi Experts,

I am using D365 Operations

Is it possible to customize to filter records in List page (InventTransferOrders). Basically, when a user opens the form(InventTransferOrders) , system should only display records for some of "From warehouse".

Thanks,

N.Sridhar

*This post is locked for comments

  • Suggested answer
    nmaenpaa Profile Picture
    101,158 Moderator on at
    RE: Filter records in list page D365 Operations

    You could try to add this logic to your code:

    Check if sender.query().queryRun() exists. If it does, apply your range to sender.query().queryRun().query(). Else apply it to sender.query() like you already do.

  • Sridhar Narayanan Profile Picture
    1,027 on at
    RE: Filter records in list page D365 Operations

    Hi,

    I could filter records based on users mapped to retail stores by writing piece of code in OnQueryExecuting event handler.

    System is displaying only filtered records at first instance.

    However, when user clears the filter manually on the field, the filter which was set using below code in OnQueryExecuting event handler is not working.

    [FormDataSourceEventHandler(formDataSourceStr(XXXPurchShipmentInterface, XXXPurchShipmentHeaderGrid), FormDataSourceEventType::QueryExecuting)]

        public static void XXXPurchShipmentHeaderGrid_OnQueryExecuting(FormDataSource sender, FormDataSourceEventArgs e)
        {
    
            SecurityUserRole        userRole;
            SECURITYROLE            securityRole;
            RetailChannelTable      retailChannelTable;
            RetailStoreTable        retailStoreTable;
            RetailStoreAddressBook  retailStoreAddressBook;
            DirAddressBookParty     dirAddressBookParty;
            HcmWorker               hcmWorker;
            DirPersonUser           dirPersonUser;
            InventParameters        inventParameters;
            RecId                   securityRoleRecord;
    
            select XXXSecurityRole from inventParameters;
            select RecId from securityRole where securityRole.AotName == '-SYSADMIN-';
            securityRoleRecord = securityRole.RecId;
            select RecId from securityRole where securityRole.Name == inventParameters.XXXSecurityRole;
            select SecurityRole from userRole where userRole.User == curUserId()
                && (userRole.SecurityRole == securityRoleRecord || userRole.SecurityRole == securityRole.RecId);
            if(!userRole)
            {
                while select XXXShipToCode from retailStoreTable
                join retailChannelTable
                where retailChannelTable.RecId == retailStoreTable.RecId
                join retailStoreAddressBook
                where retailStoreAddressBook.STORERECID == retailChannelTable.RECID
                join dirAddressBookParty
                where dirAddressBookParty.AddressBook == retailStoreAddressBook.AddressBook
                && retailStoreAddressBook.AddressBookType == RetailAddressBookType::Employee
                join hcmWorker
                where hcmWorker.PERSON == dirAddressBookParty.PARTY
                join dirPersonUser
                where dirPersonUser.PERSONPARTY == hcmWorker.PERSON
                && dirPersonUser.User == curUserId()
                {
                    sender.query().dataSourceTable(tableNum(XXXPurchShipmentHeader)).addRange(fieldnum(XXXPurchShipmentHeader, ShipToCode)).value		(retailStoreTable.XXXShipToCode);
                }
            }
        }
  • Suggested answer
    nmaenpaa Profile Picture
    101,158 Moderator on at
    RE: Filter records in list page D365 Operations

    Yes, it is possible. There are several options, and there are several things to consider before selecting the right option for you.

    Some questions:

    1) Which users?

    2) Which warehouses and how are they related to the users?

    Possible solutions in my own preferred order:

    1) Your users can create their own filters and save them. No development required.

    2) You can use xds to show only "relevant" warehouses to users, if there is some kind of link between the user and the warehouse(s) that you wish to show.

    3) You can modify the form in x++ to show only some warehouses to all users.  If you choose this option, you should create some new parameters to control which warehouses are shown and which are not. That enables the administrator to change the setting without further need for development.

    For all options you can find more information by searching the web.

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Microsoft Dynamics AX (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 100 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 48

#3
Zain Mehmood Profile Picture

Zain Mehmood 6 Moderator

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans