Creating Vendors through X++ in AX 2012- PART IV
Create a contact for the vendor
Check below posts for more details
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void createContact(VendorRequestCreate _vendorRequestCreate, RefRecId _partyId) | |
{ | |
ContactPerson contactPerson; | |
DirPersonName lDirPersonName; | |
DirPerson lDirPerson; | |
DirParty lDirParty; | |
LogisticsLocation lLogisticsLocation; | |
DirPartyContactInfoView lDirPartyContactInfoView; | |
; | |
//Create party for Contact | |
lDirPerson.Name = _vendorRequestCreate.ContactPersonName; | |
lDirPerson.NameAlias = _vendorRequestCreate.ContactPersonName; | |
lDirPerson.NameSequence = dirNameSequence::find('First Last').RecId; | |
lDirPerson.insert(); | |
lDirPersonName.FirstName = _vendorRequestCreate.ContactPersonName; | |
//lDirPersonName.MiddleName = _vendorRequestCreate.ContactPersonName; | |
//lDirPersonName.LastName = _vendorRequestCreate.LastName; | |
lDirPersonName.ValidTo = DateTimeUtil::maxValue(); | |
lDirPersonName.Person = lDirPerson.RecId; | |
lDirPersonName.insert(); | |
lDirParty = new DirParty(lDirPerson); | |
//Create contact and associate with party | |
contactPerson.ContactForParty = vendTable.Party; | |
contactPerson.Party = lDirPerson.RecId; | |
contactPerson.insert(); | |
//Create contact number | |
if(_vendorRequestCreate.ContactPersonNo != '') | |
{ | |
lLogisticsLocation.clear(); | |
lLogisticsLocation = LogisticsLocation::create('Phone', NoYes::No); | |
lDirPartyContactInfoView.LocationName = 'Primay Phone'; | |
lDirPartyContactInfoView.Locator = _vendorRequestCreate.ContactPersonNo; | |
lDirPartyContactInfoView.Party = contactPerson.Party; | |
lDirPartyContactInfoView.IsPrimary = NoYes::Yes; | |
lDirParty.createOrUpdateContactInfo(lDirPartyContactInfoView); | |
} | |
} |
Check below posts for more details
-Harry
No comments:
Post a Comment
Thanks