Tuesday, April 20, 2010

Ax 2009: import contactperson table from excel with relation venttable and custtable

İlgili kişi tablosuna satıcı ve müşteri ile bağlantılı kayıt atarken, excel tanım gruplarında tablo kurulumu>dönüştürmeye aşağıdaki kodu yaz, derle,,, gerisini axaptaya bırak...

;
contactPerson.PartyId = DirParty::createPartyFromCommon(contactPerson).PartyId;
if (!contactPerson.OrgPartyId)
{
if (contactPerson.CustAccount)
{
contactPerson.OrgPartyId = CustTable::find(contactPerson.CustAccount).PartyId;
}
else if (contactPerson.VendAccount)
{
contactPerson.OrgPartyId = VendTable::find(contactPerson.VendAccount).PartyId;
}
}

else
{
if (!contactPerson.CustAccount)
{

contactPerson.CustAccount = CustTable::findByPartyId(contactPerson.OrgPartyId).AccountNum;
}
if ( !contactPerson.VendAccount)
{
contactPerson.VendAccount = VendTable::findByPartyId(contactPerson.OrgPartyId).AccountNum;
}
}

// Create relations

DirPartyRelationship::createRecordRelations(DirRelationshipTypeTable::findBySystemType (DirSystemRelationshipType::ContactPerson).RelationshipTypeId,contactPerson.OrgPartyId,contactPerson.PartyId);

// HRm

HRMVirtualNetworkTableReplicate_Contact::insert(contactperson);

0 yorum:

Post a Comment