bypass or disable extensible data security (xds) policy on runtime AX2012 and Dynamics 365 For Finance and Operations
Views (2384)
In this blog i will show you how to bypass or disable extensible data security (xds) policy on runtime in Dynamics AX 2012 and Dynamics 365 for Finance and Operations.
The scenario is to get all records of warehouse on lookup which is already filtered through applied XDS on user.
AX2012
XDSServices xdsService = new XDSServices(); xdsService.setXDSState(0); SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(InventLocation), _ctrl); Query query = new Query(); QueryBuildDataSource queryBuildDataSource; queryBuildDataSource = query.addDataSource(tableNum(InventLocation)); sysTableLookup.addLookupfield(fieldNum(InventLocation, inventlocationid)); sysTableLookup.addLookupfield(fieldNum(InventLocation, Name)); sysTableLookup.parmQuery(query); sysTableLookup.performFormLookup();
Dynamics 365 for Finance and Operations
unchecked(uncheck::XDS) { SysTableLookup sysTableLookup = sysTableLookup::newParameters(tableNum(InventLocation), _ctrl); Query query = new Query(); QueryBuildDataSource queryBuildDataSource; queryBuildDataSource = query.addDataSource(tableNum(InventLocation)); sysTableLookup.addLookupfield(fieldNum(InventLocation, inventlocationid)); sysTableLookup.addLookupfield(fieldNum(InventLocation, Name)); sysTableLookup.parmQuery(query); sysTableLookup.performFormLookup(); }
Thanks,
Happy Coding
Comments
-
@raj because unchcking XDS is applied only on codes in the body. for this aim I think you should disable XDS when menu item wants run
-
In D365 Finance and operations .. after using your code it shows all warehouses but after selecting it gives validation message "The value 'DAM' in field 'To warehouse' is not found in the related table 'Warehouses'." and it means still XDS gets applied. how can we make this working , do you have any idea ??
*This post is locked for comments