How to Retrieve All Vendor Location IDs in X++ (Beyond Primary Addresses) in Microsoft Dynamics 365 Finance & Operations
How to Retrieve All Vendor Location IDs in X++ (Beyond Primary Addresses) in Microsoft Dynamics 365 Finance & Operations This method builds a custom lookup to fetch all location IDs linked to a vendor , regardless of whether they are marked as primary. ✅ Key Idea Instead of relying on flags like IsPrimary , this approach: Starts from LogisticsLocation (root) Joins through party and vendor tables Filters only by Vendor Account Returns all related locations 💻 Code with Explanation public void lookup() { // Create lookup object for LogisticsLocation table SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(LogisticsLocation), this); // Initialize query Query query = new Query(); // Declare data sources (tables) QueryBuildDataSource qbdsLogisticsLocation, qbdsDirParty, qbdsVendTable, qbdsTaxInfo, qbdsTaxReg; ...