Search This Blog

May 14, 2013

Creating Vendors through X++ in AX 2012- PART III

Creating Vendors through X++ in AX 2012- PART III

--Create postal address--

public void createPostalAddress(VendorRequestCreate          _vendorRequestCreate)
{
    VendorRequestAddress             vendorRequestAddress;
    DirPartyPostalAddressView           dirPartyPostalAddressView;
    ;
select Addressing, LogisticsAddressCity, LogisticsAddressCountryRegionId, LogisticsAddressStateId,
            LogisticsAddressZipCodeId from vendorRequestAddress
where vendorRequestAddress.WI_VendorRequestCreate       == _vendorRequestCreate.RecId;
// Create postal address
if(dirPerson.RecId || dirOrganisation.RecId)
    {
        dirPartyPostalAddressView.LocationName                  = 'Primary business';
        dirPartyPostalAddressView.Address                       = vendorRequestAddress.Addressing;
        dirPartyPostalAddressView.City                          = vendorRequestAddress.LogisticsAddressCity;
        dirPartyPostalAddressView.ZipCode                       = vendorRequestAddress.LogisticsAddressZipCodeId;
        dirPartyPostalAddressView.State                         = vendorRequestAddress.LogisticsAddressStateId;
        dirPartyPostalAddressView.Street                        = vendorRequestAddress.Addressing;
//dirPartyPostalAddressView.Street                        = 'Dover Street';
//dirPartyPostalAddressView.StreetNumber                  = '123';
        dirPartyPostalAddressView.CountryRegionId               = vendorRequestAddress.LogisticsAddressCountryRegionId;
        dirParty.createOrUpdatePostalAddress(dirPartyPostalAddressView);
    }
}

-Harry

No comments:

Post a Comment

Thanks