Share via


AX 2012 - Add new address in existing Party through code

LogisticsLocation   location;
    RecId               LocationRecId;
    DirPartyRecId       partyRecId = 5637174415;
    LogisticsElectronicAddress      electronicAddress;

    location = LogisticsLocation::create(DirPartyTable::findRec(partyRecId).name, false);
    DirParty::addLocation(partyRecId, location.RecId, false, true);
    electronicAddress.Location = location.RecId;
    electronicAddress.Type = LogisticsElectronicAddressMethodType::Fax;
    electronicAddress.Locator = '09012345';
    electronicAddress.ValidFrom = DirUtility::getCurrentDateTime();
    electronicAddress.ValidTo   = DateTimeUtil::maxValue();
    electronicAddress.insert();

Comments

  • Anonymous
    November 24, 2011
    Many thanks dude. I was trying to generate location all day but in vain. This really helped :)