locked
Multipple addresses crm 2013 RRS feed

  • Question

  • Hi,

    How Can I add a multpple addresses (more than two) to one acount in plugin?

    CustomerAddress ca = new CustomerAddress();

    .... and what next ?

    Wednesday, July 16, 2014 7:14 AM

All replies

  • Hi,

    Once you have instantiated CustomerAddress, you'll need to pack in the field values, something like:

    ca.ParentId = new EntityReference("account", new Guid(you_account_id"));
    ca.Line1 = "Address Line 1";
    ca.Line2 = "Address Line 2";
    ca.Line3 = "Address Line 3";
    ca.City = "City";

    You can add/remove more field values if you want, but make sure to have the "ParentId", since that will determine to which Account the Address will be associated to.

    Once you're done packing the data, simply call use:

    service.Create(ca);

    to create the Customer Address. The "service" is an object of Organisation Service Proxy.

    To create multiple addresses, simply use the above two code snippets in a loop.


    Admin QuikView Solution for CRM 2013


    Wednesday, July 16, 2014 7:25 AM
  • Hello,

    You can use either execute multiple or can use deep insert to create multiple record.


    Our Website| Our Blog | Follow US | My Facebook Page | Microsoft Dynamics CRM 2011 Application Design
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    Wednesday, July 16, 2014 7:30 AM
    Moderator