最新消息:ww12345678 的部落格重装上线,希望大家继续支持。

AX7/D365/Operations: Create customer postal address through data entity from .NET console application

网络文摘 William 1554浏览 0评论

Purpose:

The purpose of this document is to demonstrate how we can create customer postal addresses in Dynamics 365 for Finance and Operations using an external .NET console application.

Code:

public void testCustomerAddressCreate(Resources _context)
{
      DataServiceCollection dataServiceCollection = new DataServiceCollection(_context);
      CustomerPostalAddress customerPostalAddress = new CustomerPostalAddress();

      dataServiceCollection.Add(customerPostalAddress);

      customerPostalAddress.CustomerLegalEntityId = "CPL";
      customerPostalAddress.CustomerAccountNumber = "C0000010";
      customerPostalAddress.AddressDescription = "Test address from OData 44.";
      customerPostalAddress.IsRoleBusiness = NoYes.Yes;
      customerPostalAddress.IsPostalAddress = NoYes.Yes;
      customerPostalAddress.AddressLocationRoles = "Address role";
      customerPostalAddress.AddressCountryRegionId = "AUS";
      customerPostalAddress.AddressZipCode = "2151";
      customerPostalAddress.AddressCity = "NORTH ROCKS";
      customerPostalAddress.AddressState = "NSW";

      DataServiceResponse response = null;

      try
      {
          response = _context.SaveChanges(SaveChangesOptions.PostOnlySetProperties);
      }
      catch (Exception ex)
      {
          Console.WriteLine(ex.Message + ex.InnerException);
      }

      Console.ReadLine();
}

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址