Wednesday, July 13, 2022

Address in D365Fo

Address in D365Fo.


Vendor address: 

    Info(strFmt('Postal - %1', VendTable::find('Vendor Id').postalAddress().Address));

    Info(strFmt('Delivey - %1', VendTable::find('Vendor Id').deliveryAddress().Address));

    Info(strFmt('Invoice - %1', VendTable::find('Vendor Id').invoiceAddress().Address));


Cusomer address:

    Info(strFmt('Postal - %1', CustTable::find('Customer Id').postalAddress().Address));

    Info(strFmt('Postal - %1', CustTable::find('Customer Id').address()));

    Info(strFmt('Invoice - %1', CustTable::find('Customer Id').invoiceAddress().Address));

Warehouse address:

    Info(strFmt('Address - %1', InventLocation::find('InventLocationId').
                                                    logisticsPostalAddress().Address));

    Info(strFmt('Address - %1', InventLocation::find('InventLocationId').Address())); 

    InventLocationLogisticsLocation        inventLocationLogisticsLocation;
    RecId                                  inventLocationRecId;        
    
    Select firstOnly inventLocationLogisticsLocation
        where inventLocationLogisticsLocation.InventLocation == inventLocationRecId
           && inventLocationLogisticsLocation.IsPrimary == NoYes::Yes;

    LogisticsLocation       logisticsLocation = LogisticsLocation::find(
                                                    inventLocationLogisticsLocation.Location);
    
    LogisticsPostalAddress  logisticsPostalAddress  = LogisticsPostalAddress::findRecId(
                                                                    logisticsLocation.RecId);

    Info(strFmt('Address - %1', logisticsPostalAddress.Address));

Site address:

    Info(strFmt('Address - %1', InventSite::find('Site Id').logisticsPostalAddress().Address));


Different Way to Get any Active address:

    LogisticsLocationEntity::location2PostalAddress(transTaxInformation.CompanyLocation, 
                                            DateTimeUtil::getSystemDateTime(), true)

Keep Daxing!! 

No comments:

Post a Comment