Показать сообщение отдельно
Старый 20.10.2020, 08:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
dynamicsaxinsight: Create contact information in X++
Источник: https://dynamicsaxinsight.wordpress....mation-in-xpp/
==============

Purpose:

The purpose of this blog post is to demonstrate how to create contact information in X++

Product:

Dynamics AX 2012

Description:

The code create contact information with purpose “Collection” on the customer record.

Code:

static void MAKCustContactCreate(Args _args) { #define.LocationRoleName('Collection') CustTable custTable; DirPartyTable dirPartyTable; LogisticsElectronicAddress logisticsElectronicAddress; LogisticsLocationRole locationRole; Map locationRoleMap; container locationRoleCon; ; custTable = CustTable::find('C000115'); dirPartyTable = DirPartyTable::findRec(custTable.Party); if (!dirPartyTable.existElectronicAddrbyRole(#LocationRoleName)) { locationRoleMap = new Map(Types::Int64, Types::String); locationRole = LogisticsLocationRole::findByName(#LocationRoleName); if (locationRole) { locationRoleMap.insert(locationRole.RecId, locationRole.description()); locationRoleCon = map2Con(locationRoleMap); ttsBegin; logisticsElectronicAddress.Type = LogisticsElectronicAddressMethodType::Email; logisticsElectronicAddress.Locator = 'testUserAccount2@domain.com'; logisticsElectronicAddress.Location = DirPartyLocation::findOrCreate(CustTable.Party, 0).Location; logisticsElectronicAddress = LogisticsElectronicAddress::findOrCreate(logisticsElectronicAddress); logisticsElectronicAddress = LogisticsElectronicAddress::findRecId(logisticsElectronicAddress.RecId, true); logisticsElectronicAddress.Description = "Email from X++"; logisticsElectronicAddress.IsPrimary = NoYes::No; logisticsElectronicAddress.update(); LogisticsEntityLocationRoleMap::createEntityLocationRoles(tableNum(LogisticsElectronicAddressRole), logisticsElectronicAddress.RecId, conPeek(locationRoleCon, 1), true); ttsCommit; info(strFmt("Created/updated email address %1 for customer %2.", logisticsElectronicAddress.Locator, custTable.AccountNum)); } } }


Источник: https://dynamicsaxinsight.wordpress....mation-in-xpp/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.