Ever wonder if there is an easy way to find out what customer account a sales company has at the production company?
This might not be an easy way, but it is one way to do it:
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 | static void FO_MyCustAccount(Args _args) { VendTable vendTable; AifEndpointId endpointId; AifEndpoint toEndpoint, meEndPoint; AifEndPointConstraint endPointConstraint; ; // Intercompany Vendor = 3045. vendTable = VendTable::find("3045"); // Get Vendor endpointId. endpointId = vendTable.interCompanyEndpointId(); // Get the endpoint. toEndpoint = AifEndPoint::find(endpointId); // Change to endPoint company. changecompany(toEndpoint.InterCompanyCompanyId) { // Get your endpoint in Parent company. meEndPoint = AifEndpoint::findInterCompany( toEndpoint.dataAreaId); // Find customer constraint. endPointConstraint = AifEndPointConstraint::find( meEndPoint.EndpointId, AifConstraintType::Customer); } // ConstraintId = Your customer account. info(endPointConstraint.ConstraintId); } |
Last 5 posts in Development
- No valid document identified from the entity key - April 9th, 2010
- Using Regular Expressions in Dynamics AX - October 2nd, 2009
- Create class and methods in x++ - December 22nd, 2008
- Simple field lookup in form - October 13th, 2008
- Sorting containers with multiple levels - September 22nd, 2008
Great post, most informative, didn’t realise devops were into this.