Monday, 21 February 2022

Create vendor party id in d365 F&O

 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

DefaultDimension in d365 FO X++

 Navigate to PurchTable methods you can find with DefaultDimension this.DefaultDimension = this.mergeDimension(this.getDefaultDimension(),th...