Get the contact information which is primary for the vendor in d365fo x++

 static void getTheContactByvendor(Args _args)

{

    VendTable                       vendTable;

    DirPartyTable                   dirPartyTable;

    LogisticsElectronicAddress      logisticsElectronicsAddress;

    AccountNum                      accountNum                  =   "1001";

    RecId                           recId;

    


    select firstOnly   vendTable

        where   vendTable.AccountNum                            ==  accountNum;


    select logisticsElectronicsAddress

        join    dirPartyTable

            where   logisticsElectronicsAddress.RecId           ==   dirPartyTable.PrimaryContactPhone

            &&      dirPartyTable.RecId                         ==   vendTable.Party  

            &&      logisticsElectronicsAddress.Type            ==  LogisticsElectronicAddressMethodType::Phone

            &&      logisticsElectronicsAddress.IsPrimary       ==  NoYes::Yes;

 

    info(strFmt("Description : %1 \n Type : %2 \n Contact number : %3 \n Primary : %4 ",logisticsElectronicsAddress.Description,logisticsElectronicsAddress.Type,logisticsElectronicsAddress.Locator,logisticsElectronicsAddress.IsPrimary));



}

Comments