Показать сообщение отдельно
Старый 13.01.2015, 18:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,646 / 848 (80) +++++++
Регистрация: 28.10.2006
bojensen: Getting addresses by type X++ | Microsoft Dynamics AX & CRM | AXPulse
Источник: http://blogs.bojensen.eu/2015/01/13/...x-crm-axpulse/
==============

This post shows the code which helps in retrieving the address of Party (Customer, Vendor etc.) by providing the type of addresses. Function which takes Party and LogisticsLocationRoleType (Invoice, Delivery, Shipping etc.)

X++:
public static LogisticsPostalAddress getPostalAddressByType(DirPartyRecId _party, LogisticsLocationRoleType _type)
{
    DirPartyLocation        partyLocation;
    DirPartyLocationRole    partyLocationRole;
    LogisticsLocation       location;
    LogisticsLocationRole   locationRole;
    LogisticsPostalAddress  postalAddress;
    ;
    select firstonly postalAddress
    exists join location
        where location.RecId == postalAddress.Location
    exists join locationRole
        where locationRole.Type  == _type
    exists join partyLocation
        where partyLocation.Location == location.RecId 
        && partyLocation.Party == _party
    exists join partyLocationRole
        where partyLocationRole.PartyLocation == partyLocation.RecId 
        && partyLocationRole.LocationRole == locationRole.RecId;

    return postalAddress;
}

Источник: http://blogs.bojensen.eu/2015/01/13/...x-crm-axpulse/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.

Последний раз редактировалось mazzy; 15.01.2015 в 12:56.