Tuesday, February 25, 2014

Update or Create Party Addresses

Following code helps you to create or update party (Customer/Vendor/Employees) addresses using standard function

select firstOnly postalAddressView
                    join Location,LocationRole from locationRolesView
                   where locationRolesView.Location     == postalAddressView.Location
                      && locationRolesView.LocationRole == LogisticsLocationRole.RecId
                      && postalAddressView.Party        == partyId;


        postalAddressView.Street           = street1;
        if(street2)
        {
            postalAddressView.Street           += " " + street2;
        }
        postalAddressView.City             = city;
        postalAddressView.State            = stateId;
        postalAddressView.CountryRegionId  = countryCode;
        postalAddressView.ZipCode          = zipCode;
        postalAddressView.Address          = LogisticsPostalAddress::formatAddress(postalAddressView.Street,  postalAddressView.ZipCode, postalAddressView.City, postalAddressView.CountryRegionId, postalAddressView.State,'');
        postalAddressView.IsPrivate        = NoYes::No;


        postalAddressViewResult = dirParty.createOrUpdatePostalAddress(postalAddressView,[LogisticsLocationRole.recid]);

No comments:

Post a Comment