Creation of Vendor a/c using data entity

 This code will help you to create Vendor a/c 

class VendCreationJob

{

    /// <summary>

    /// Runs the class with the specified arguments.

    /// </summary>

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

    public static void main(Args _args)

    {

        //Using data entity to create Vendor a/c

        VendVendorV2Entity vendTable;

      

        try

        {

            ttsBegin;

            //Vendor personal details

            VendTable.initValue();

            VendTable.DefaultVendorPaymentMethodName      = "CHECK";

            VendTable.DefaultPaymentTermsName             = 'Net45';

            vendTable.VendorOrganizationName              = "Sayooj";

            vendTable.VendorSearchName                    = "Sajith";

            vendTable.VendorPartyType                     = "Organization";

            VendTable.VendorGroupId                       = '30';

            VendTable.CurrencyCode                        = 'USD';

            VendTable.PaymentId                           = 'Net45';

            vendTable.LanguageId                          = "en-us";

        

            //Vendor address details 

            vendTable.AddressLocationRoles                = "Business";

            vendTable.AddressDescription                  = "HeadQuarters";

            vendTable.AddressCountryRegionId              = "BRA";

            vendTable.AddressStateId                      = "SP";

            vendTable.AddressCity                         = 'São Paulo';

            vendTable.AddressStreet                       = '4th Avenue';

            vendTable.AddressStreetNumber                 = '18';

            //Vendor contact details

            vendTable.PrimaryPhoneNumberDescription       = 'Contact Phone';

            vendTable.PrimaryPhoneNumberPurpose           = "Business";

            vendTable.PrimaryPhoneNumber                  = "561291156431";

            vendTable.IsPrimaryPhoneNumberMobile          = NoYes::Yes;

            vendTable.PrimaryEmailAddressDescription      = 'Email';

            vendTable.PrimaryEmailAddress                 = 'ssmurgesh97@gmail.com';

          

            VendTable.insert();


            info(strFmt("vendor has been created with number %1.",vendTable.VendorAccountNumber));


            ttsCommit;

        }


        catch(Exception::Error)

        {

            throw Exception::Error;

        }

}


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