Creation of customer a/c by using data entity
This code will help you to create customer account
class CustomerCreationJob
{
/// <summary>
/// Runs the class with the specified arguments.
/// </summary>
/// <param name = "_args">The specified arguments.</param>
public static void main(Args _args)
{
//Declarationof data entity
CustCustomerV3Entity custTable;
ttsbegin;
custTable.initValue();
try
{
//Customer details
custTable.PartyType = "Organization";
custTable.OrganizationName = "Muragesh s";
custTable.CustomerGroupId = "10";
custTable.PaymentTerms = "Net10";
custTable.PaymentMethod = "CHECK";
custTable.LanguageId = "en-us";
custTable.SalesCurrencyCode = "EUR";
//Customer address
custTable.AddressLocationRoles = "Business";
custTable.AddressDescription = "Delivery address";
custTable.AddressCity = "Bangalore";
custTable.AddressCountryRegionISOCode = "US";
custTable.AddressStreetNumber = "101";
custTable.AddressStreet = "Test";
custTable.AddressState = "NY";
//Customer contact details
custTable.PrimaryContactEmailPurpose = "Business";
custTable.PrimaryContactEmailDescription = "Email Address";
custTable.PrimaryContactEmail = "test@gmail.com";
custTable.PrimaryContactPhoneDescription = "Mobile Number";
custTable.PrimaryContactPhonePurpose = "Business";
custTable.PrimaryContactPhone = "1234567889";
custTable.insert();
ttscommit;
info(strFmt("Customer account has been created with A/c number %1",custTable.SalesAccountNumber));
}
catch(Exception::Error)
{
ttsAbort;
throw Exception::Error;
}
}
}