vendTable.Party = DDDCustVendGlobal::createPartyId(DirPartyType::Organization,vendorCreateContract.VendorOrganizationName(),LanguageID());
public static RefRecId createPartyId( DirPartyType _partyType,
DirPartyName _custVendName,
LanguageId _sourceLanguageId )
{
FirstName firstName = '';
MiddleName middleName = '';
LastName lastName = '';
DirPerson person;
DirPersonName personName;
DirPartyTable partyRecord;
if (_partyType == DirPartyType::Person)
{
if (lastName == '')
{
[firstName, middleName, lastName] = DirPerson::splitNameParts(_custVendName);
}
person.initValue();
person.Name = _custVendName;
person.insert();
personName = DirPersonName::addNewNameToPerson(person.RecId, firstName, middleName, lastName);
partyRecord = DirPartyTable::findRec(person.RecId, true);
}
else
{
partyRecord = DirPartyTable::createNew(_partyType, _custVendName);
}
partyRecord.LanguageId = _sourceLanguageId;
partyRecord.update();
return partyRecord.RecId;
}
No comments:
Post a Comment