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
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.
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); } } }
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.
Mohamed Amine Mahmoudi
100
Super User 2025 Season 1
Community Member
48
Zain Mehmood
6
Moderator