Get Sales Order Address in dynamics 365 F&O X++
{
select RecId from logisticsLocation index hint
LogisticsLocationIdx where logisticsLocation.RecId == logisticsPostalAddress.Location;
select RecId from dirPartyLocation where dirPartyLocation.Location == logisticsLocation.RecId;
SalesAddressContract = new SalesAddressContract();
SalesAddressContract.parmAddressDescription(logisticsLocation.Description);
SalesAddressContract.parmDeliveryAddressName(DIRPARTYTABLE::findRec(dirPartyLocation.Party).Name);
SalesAddressContract.parmAddressStreet(logisticsPostalAddress.Street);
SalesAddressContract.parmAddressCity(logisticsPostalAddress.City);
SalesAddressContract.parmAddressState(logisticsPostalAddress.State);
SalesAddressContract.parmAddressCountryRegionId(logisticsPostalAddress.CountryRegionId);
SalesAddressContract.parmAddressZipCode(logisticsPostalAddress.ZipCode);
SalesAddressContract.parmAddressCountryRegionId(logisticsPostalAddress.CountryRegionId);
SalesAddressContract.parmsunTAFMarkForExtAddressCode(logisticsLocation.ExtAddressCode);// Custom field
addressList.addEnd(SalesAddressContract);
}
Find phone and contact person in the contact information
public str phonePersonName(SalesTable _salesTable)
{
LogisticsElectronicAddress electronicAddress;
electronicAddress = DirParty::primaryElectronicAddress(CustTable::find(_salesTable.CustAccount).Party,
LogisticsElectronicAddressMethodType::Phone);
if (!electronicAddress)
{
electronicAddress =
DirParty::getElectronicAddressForPartyPostalAddress(CustTable::find(_salesTable.CustAccount).Party,
LogisticsElectronicAddressMethodType::Phone);
}
return electronicAddress.Description;
}
display Phone phone()
{
LogisticsElectronicAddress electronicAddress;
electronicAddress = DirParty::primaryElectronicAddress(this.Party,
LogisticsElectronicAddressMethodType::Phone);
if (!electronicAddress)
{
electronicAddress =
DirParty::getElectronicAddressForPartyPostalAddress(this.Party,
LogisticsElectronicAddressMethodType::Phone);
}
return electronicAddress ?
electronicAddress.Locator : '';
}
No comments:
Post a Comment