CustTable CustTable,CustTableLoc,CustTableLoc2;
DirpartyTable DirpartyTable;
DirPersonPartyDetail DirPersonPartyDetail;
DirPartyAddressRelationship DirPartyAddressRelationship;
Address Address;
DirPartyAddressRelationshipMapping DirPartyAddressRelationshipMapping;
;
select CustTableLoc2 where CustTableLoc2.Phone== "9600147034145" || CustTableLoc2.Email == "rohitsinghbatchu1@hotmail.com";
if(CustTableLoc2)
{
throw error("duplicate phone number or Email Please create a new account");
}
else
{
CustTable.initValue();
CustTable.AccountNum ="Mcafee10000023";
CustTable.CustGroup = "Test";
CustTable.Name ="ROhit Singh";
CustTable.PartyType = DirPartyType::Person;
CustTable.Phone = "9600147034145";
CustTable.Email = "rohitsinghbatchu1@hotmail.com";
CustTable.LanguageId = "en-us";
if(CustTable.validateWrite())
{
CustTable.insert();
}
info(strfmt("%1",CustTable.AccountNum));
CustTable.Street = 'Knowledge Village';
CustTable.City = 'dubai';
CustTable.CountryRegionId = 'UAE';
CustTable.ZipCode = '502964';
dirparty::updatePartyFromCommonInsert(CustTable.PartyId, CustTable);
}
select DirpartyTable
where DirpartyTable.PartyId ==CustTable.PartyId;
select DirPersonPartyDetail
where DirPersonPartyDetail.PartyId == DirpartyTable.PartyId;
if(DirPersonPartyDetail)
{
info(strfmt("%1",DirPersonPartyDetail.AnniversaryDate));
}
else
{
DirPersonPartyDetail.initValue();
DirPersonPartyDetail.BirthDate = 12\12\1984;
DirPersonPartyDetail.PartyId = CustTable.PartyId;
DirPersonPartyDetail.Gender = Gender::Male;
DirPersonPartyDetail.insert();
}
ttsbegin;
select forupdate CustTableLoc where CustTableLoc.AccountNum == CustTable.AccountNum;
CustTableLoc.LanguageId = "en-us";
CustTableLoc.Name = "Rohit Singh";
CustTableLoc.update();
ttscommit;
}