Need to import Contact Information like Phone number … from excel to ax using jobs.
OK, you haven’t told what you need? Do you already have vendors in AX? Please elaborate.
Hi kranthi,
Need to import contact number and description of vendor from excel to ax .
I have already imported vendor account, group, site, warehouse and also address . Along with this I need to import phone number into contact information(tab) of vendor master.
Hi Gopinath,
Tq for ur reply. But this is not my actual requirement. I need Phone number to be imported into Contact Information tab of Vendor. I already imported other fileds .
Have a look at \Classes\RetailTransactionServiceCustomer\upsertPartyLogisticsElectronicAddress
You need to insert into LogisticsLocation, DirPartyLocation, logisticsElectronicAddress
Hi Kranthi,
Still I didn’t get it.
Hi Kranthi,
Still I didn’t get it.
Hi, Kiran
Please try with this job, I hope it will be useful for you.
static void uploadVendorDetails(Args _args)
{
CommaTextIO csvFile;
container readCon;
Dialog dialog;
DialogField dfFileName;
FileName fileName;
VendTable vendTable;
DirParty dirParty;
DirPartyRecId partyRecId;
AccountNum accountNum;
DirPartyContactInfoView contactView;
#File
dialog = new Dialog(“Pick the file”);
dfFileName = dialog.addField(extendedTypeStr(“FilenameOpen”));
dialog.filenameLookupFilter([‘csv’,’*.csv’]);
if (dialog.run())
{
csvFile = new CommaTextIo(dfFileName.value(), ‘r’);
csvFile.inFieldDelimiter(’,’);
readCon = csvFile.read();
while(csvFile.status() == IO_Status::OK)
{
readCon = csvFile.read();
if(readCon)
{
accountNum = conPeek(readCon,1);
vendTable = vendTable::find(conPeek(readCon,1));
partyRecId = vendTable.Party;
DirParty = DirParty::constructFromPartyRecId(partyRecId);
select contactView
where contactView.Party == vendTable.Party
&& contactView.Type == LogisticsElectronicAddressMethodType::Phone;
// Phone description and Phone number
if ((contactView.RecId == 0) && (conPeek(readCon,2) != “”)) // Please comment this condition, if not required
{
contactView.LocationName = “Phone Number”; // Phone description
contactView.Locator = strLRTrim(conPeek(readCon,3)); // Phone Number
contactView.Type = LogisticsElectronicAddressMethodType::Phone;
contactView.Party = partyRecId;
contactView.IsPrimary = NoYes::Yes;
dirParty.createOrUpdateContactInfo(contactView);
}
select contactView
where contactView.Party == vendTable.Party
&& contactView.Type == LogisticsElectronicAddressMethodType::Email;
// Email name and emailId
if ((contactView.RecId == 0) && (conPeek(readCon,4) != “”)) // Please comment this condition, if not required
{
contactView.LocationName = “Email”; // Email description
contactView.Locator = strLRTrim(conPeek(readCon, 5)); // EmailId
contactView.Type = LogisticsElectronicAddressMethodType::Email;
contactView.Party = partyRecId;
contactView.IsPrimary = NoYes::Yes;
dirParty.createOrUpdateContactInfo(contactView);
}
select contactView
where contactView.Party == vendTable.Party
&& contactView.Type == LogisticsElectronicAddressMethodType::URL;
// URL description and URL
if ((contactView.RecId == 0) && (conPeek(readCon,6) != “”)) // Please comment this condition, if not required
{
contactView.LocationName = “URL”; // URl Description
contactView.Locator = strLRTrim(conPeek(readCon,7)); // URL
contactView.Type = LogisticsElectronicAddressMethodType::URL;
contactView.Party = partyRecId;
contactView.IsPrimary = NoYes::Yes;
dirParty.createOrUpdateContactInfo(contactView);
}
select contactView
where contactView.Party == vendTable.Party
&& contactView.Type == LogisticsElectronicAddressMethodType::Fax;
// Fax description and Fax number
if ((contactView.RecId == 0) && (conPeek(readCon,8) != “”)) // Please comment this condition, if not required
{
contactView.LocationName = “Fax”; // Fax Description
contactView.Locator = strLRTrim(conPeek(readCon,9)); // Fax description
contactView.Type = LogisticsElectronicAddressMethodType::Fax;
contactView.Party = partyRecId;
contactView.IsPrimary = NoYes::Yes;
dirParty.createOrUpdateContactInfo(contactView);
}
}
}
}
}
If it works please take your time to mark as ‘This helped me’
Thank You!
Thanks for ur code.