Purpose:
The purpose of this blog post is to share handy queries for addresses and contact information with the community
- Get site from contact information record
- Get site from address record
- Get warehouse from contact information record
- Get warehouse from address record
- Get customer from contact information record
- Get customer from address record
- Get vendor from contact information record
- Get vendor from address record
Product:
D365 Finance and Operations + Dynamics AX 2012
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | static void Address_Contact_Info_Queries(Args _args) { InventLocationLogisticsLocation inventLocationLogisticsLocation; InventSiteLogisticsLocation inventSiteLogisticsLocation; LogisticsElectronicAddress logisticsElectronicAddress; LogisticsPostalAddress logisticsPostalAddress; LogisticsLocation logisticsLocation; InventLocation inventLocation; InventSite inventSite; DirPartyLocation dirPartyLocation; DirPartyTable dirPartyTable; CustTable custTable; VendTable vendTable; ; // Get site from communication details while select inventSite join inventSiteLogisticsLocation where inventSiteLogisticsLocation.Site == inventSite.RecId join firstonly logisticsLocation where logisticsLocation.ParentLocation == inventSiteLogisticsLocation.Location join firstOnly logisticsElectronicAddress where logisticsElectronicAddress.Location == logisticsLocation.RecId && logisticsElectronicAddress.RecId == 5637634246 { info(strFmt( "1. Site contact %1 %2" , inventSite.SiteId, logisticsElectronicAddress.Locator)); } // Get site from addresses while select inventSite join inventSiteLogisticsLocation where inventSiteLogisticsLocation.Site == inventSite.RecId join firstonly logisticsLocation where logisticsLocation.RecId == inventSiteLogisticsLocation.Location join firstOnly logisticsPostalAddress where logisticsPostalAddress.Location == logisticsLocation.RecId && logisticsPostalAddress.RecId == 5638869576 { info(strFmt( "2. Site address %1 %2" , inventSite.SiteId, logisticsPostalAddress.Address)); } // Get warehouse from communication details while select inventlocation join inventLocationLogisticsLocation where inventLocationLogisticsLocation.InventLocation == inventlocation.RecId join firstonly logisticsLocation where logisticsLocation.ParentLocation == inventLocationLogisticsLocation.Location join firstOnly logisticsElectronicAddress where logisticsElectronicAddress.Location == logisticsLocation.RecId && logisticsElectronicAddress.RecId == 5639502490 { info(strFmt( "3. Warehouse contact %1 %2" , inventlocation.InventLocationId, logisticsElectronicAddress.Locator)); } // Get warehouse from addresses while select inventlocation join inventLocationLogisticsLocation where inventLocationLogisticsLocation.InventLocation == inventlocation.RecId join firstonly logisticsLocation where logisticsLocation.RecId == inventLocationLogisticsLocation.Location join firstOnly logisticsPostalAddress where logisticsPostalAddress.Location == logisticsLocation.RecId && logisticsPostalAddress.RecId == 5638869577 { info(strFmt( "4. Warehouse address %1 %2" , inventlocation.InventLocationId, logisticsPostalAddress.Address)); } // Get customer from communication details while select custTable join dirPartyTable where dirPartyTable.RecId == custTable.Party join dirPartyLocation where dirPartyLocation.Party == dirPartyTable.RecId join firstOnly logisticsLocation where logisticsLocation.RecId == dirPartyLocation.Location join firstOnly logisticsElectronicAddress where logisticsElectronicAddress.Location == logisticsLocation.RecId && logisticsElectronicAddress.RecId == 5638681887 { info(strFmt( "5. Customer contact %1 %2" , custTable.AccountNum, logisticsElectronicAddress.Locator)); } // Get customer from addresses while select custTable join dirPartyTable where dirPartyTable.RecId == custTable.Party join dirPartyLocation where dirPartyLocation.Party == dirPartyTable.RecId join firstOnly logisticsLocation where logisticsLocation.RecId == dirPartyLocation.Location join firstOnly logisticsPostalAddress where logisticsPostalAddress.Location == logisticsLocation.RecId && logisticsPostalAddress.RecId == 5638869578 { info(strFmt( "6. Customer address %1 %2" , custTable.AccountNum, logisticsPostalAddress.Address)); } // Get vendor from communication details while select vendTable join dirPartyTable where dirPartyTable.RecId == vendTable.Party join dirPartyLocation where dirPartyLocation.Party == dirPartyTable.RecId join firstOnly logisticsLocation where logisticsLocation.RecId == dirPartyLocation.Location join firstOnly logisticsElectronicAddress where logisticsElectronicAddress.Location == logisticsLocation.RecId && logisticsElectronicAddress.RecId == 5638265744 { info(strFmt( "7. Vendor contact %1 %2" , vendTable.AccountNum, logisticsElectronicAddress.Locator)); } // Get vendor from addresses while select vendTable join dirPartyTable where dirPartyTable.RecId == vendTable.Party join dirPartyLocation where dirPartyLocation.Party == dirPartyTable.RecId join firstOnly logisticsLocation where logisticsLocation.RecId == dirPartyLocation.Location join firstOnly logisticsPostalAddress where logisticsPostalAddress.Location == logisticsLocation.RecId && logisticsPostalAddress.RecId == 5638869579 { info(strFmt( "8. Vendor address %1 %2" , vendTable.AccountNum, logisticsPostalAddress.Address)); } } |
Comments
Post a Comment