среда, 5 сентября 2018 г.

Get LogisticsLocation record from customer

Hi! 
Today I've had a requirement to show some custom fields from the LogisticsLocation record from the customer table. I wrote a display method for a particular field, but this approach can be used in different ways. It depends on your requirements.
So, below the code:

public display IsReservedAccount displayIsReservedAccount(CustTable _customer)
{
    DirParty                        dirParty;
    LogisticsLocation               location;
    LogisticsPostalAddress          address;
    dirParty = DirParty::constructFromCommon(_customer);
    address = dirParty.getPrimaryPostalAddressLocation().getPostalAddress();
    location = LogisticsLocation::find(address.Location);
    return location.IsReservedAccount;
}
Hope it will be useful for someone as for myself.