x++ code to find Vendor Primary Contact Details in ax 2012

static void vendorPrimaryContactDetails(Args _args)
{
    VendTable       vendTable;
    ContactPerson   contactPerson;
    DirPartyTable   dirPartyTable;
    LogisticsElectronicAddress  logisticsElectronicAddress;
   
   
   
    vendTable = VendTable::find('AP000000888');//Vendor Account Number
    contactPerson = ContactPerson::find(vendTable.ContactPersonId);
    dirPartyTable =DirPartyTable::findRec(contactPerson.Party,false,DirPartyType::Person);
    logisticsElectronicAddress = LogisticsElectronicAddress::findRecId(dirPartyTable.PrimaryContactEmail);
    info(strFmt("Name: %1,EmailAddress: %2 ",dirPartyTable.Name,logisticsElectronicAddress.Locator));
     
   
}

Comments

Popular posts from this blog

x++ code to add hyperlink to a field in D365FO

x++ code to get Vendor Email Address based on Purpose in Dynamics 365 for Operations

x++ code to get Customer Address based on purpose in ax 2012