To create customer/vendor contacts, we can use Microsoft Dynamics Excel add-in, however, few times we need x++ code to do the job. Following is the code that reads a cvs file and then creates contacts against vendor using x++ code
static void ContactCreate(Args _args)
{
VendTable vendTable;
DirParty dirParty;
DirPartyContactInfoView contact;
CommaTextIo file;
container record;
;
file = new CommaTextIo("C:\\VendorContacts.csv",'r');
file.inFieldDelimiter(',');
while (file.status() == IO_Status::Ok)
{
record = file.read();
vendTable = VendTable::find(conPeek(record,1));
if (vendTable.RecId)
{
dirParty = DirParty::constructFromCommon(vendTable);
contact.CountryRegionCode = conPeek(record,2); // e.g "USA"
contact.LocationName = conPeek(record,7); // e.g "Main Phone" "Fax" "Email"
contact.Locator = conPeek(record,3); // e.g (xxx)-2333889
contact.Type = conPeek(record,15); // See base enum "LogisticsElectronicAddressMethodType"
contact.ValidFrom = datetobeginUtcDateTime(1\1\2012, DateTimeUtil::getUserPreferredTimeZone()) ;
contact.ValidTo = datetobeginUtcDateTime(1\1\2154, DateTimeUtil::getUserPreferredTimeZone()) ;
contact.Party = vendTable.Party;
dirParty.createOrUpdateContactInfo(contact);
}
}
}
kd shoes
ReplyDeleteoff white
kevin durant shoes
yeezy boost 500
bape shoes
supreme
supreme hoodie
off-white
yeezys
paul george shoes