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

Notifications

Announcements

No record found.

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

I have the same question (0)
  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    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.

  • Sridhar Narayanan Profile Picture
    1,027 on at

    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,160 Moderator on at

    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.

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans