X++ code to fetch the customer address by using select statement

  Code :-

class BAS_CustomerAddressQuery

{

    /// <summary>

    /// Runs the class with the specified arguments.

    /// </summary>

    /// <param name = "_args">The specified arguments.</param>

    public static void main(Args _args)

    {

        //Instatiation of tables

      

        CustTable custtab;

        DirPartyTable dirparty;

        DirPartyLocation dirloc;

        LogisticsLocation loglocation;

        LogisticsElectronicAddress logelectronic;

        logisticspostaladdress logPA;


        //Query to fetch address and joining tables


        while select * from custtab

           where custtab.AccountNum == "3002"

           join dirparty

           where dirparty.RecId == custtab.Party

           join dirloc

           where dirloc.Party == dirparty.RecId

           join loglocation

           where loglocation.RecId == dirloc.Location

           join logPA

           where logPA.Location == loglocation.RecId


           info(strFmt("Customer id %1 and address %2 name %3",custtab.AccountNum,logPA.Address,custtab.nameAlias()));


    }


}

Comments

Popular posts from this blog

How to Create a wizard in x++ d365

how to post trade agreement journals automatically using x++ code

X++ code to CREATE AND POST A TRADE AGREEMENT IN MICROSOFT DYNAMICS 365 in D365 F & O