locked
How to create a record in customeraddress enity RRS feed

  • Question

  • Hi Everyone,

    Can we create a 'customeraddress' entity record for a specific account/contact programatically through a plugin/custom workflow?

    Reply asap


    Ravideep Bansal

    Friday, January 18, 2013 9:27 AM

Answers

  • Hi,

    Yes, you can create more address records. you need to set two extra properties with other fields.

     Entity _Entity=new Entity("customeraddress");

    _Entity["name"]="more address";

    _Entity["line1"]="street 1";

    _Entity["objecttypecode"]= "account" or "contact";

    _Entity["parentid"]=new EntityReference("account/contact",GUID of the account/contact));//--- use account if you want to create account more address or else use contact.

    service.Create(_Entity);


    Hope this helps. If you get answer of your question, please mark the response as an answer and vote as helpful !
    Vikram !



    • Edited by _Vikram Friday, January 18, 2013 9:49 AM
    • Marked as answer by RavideepBansal Monday, January 21, 2013 8:50 AM
    Friday, January 18, 2013 9:38 AM

All replies

  • Hi,

    Yes, you can create more address records. you need to set two extra properties with other fields.

     Entity _Entity=new Entity("customeraddress");

    _Entity["name"]="more address";

    _Entity["line1"]="street 1";

    _Entity["objecttypecode"]= "account" or "contact";

    _Entity["parentid"]=new EntityReference("account/contact",GUID of the account/contact));//--- use account if you want to create account more address or else use contact.

    service.Create(_Entity);


    Hope this helps. If you get answer of your question, please mark the response as an answer and vote as helpful !
    Vikram !



    • Edited by _Vikram Friday, January 18, 2013 9:49 AM
    • Marked as answer by RavideepBansal Monday, January 21, 2013 8:50 AM
    Friday, January 18, 2013 9:38 AM
  •     Entity CustomerAddress = new Entity("customeraddress");
                                        CustomerAddress["parentid"] = new EntityReference("contact", contactid);
                                        CustomerAddress["primarycontactname"] = studentName;
                                        CustomerAddress["name"] = "Home Address";
                                        CustomerAddress["telephone1"] = studentHomePhone;
                                        string str = someAddress;
                                        int chunkSize = 250;
                                        int stringLength = str.Length;
                                        string[] HomeAddress = new string[3];
                                        for (int i = 0, p = 0; i < stringLength; i += chunkSize, p++)
                                        {
                                            if (i + chunkSize > stringLength) chunkSize = stringLength - i;
                                            HomeAddress[p] = str.Substring(i, chunkSize);
                                        }
                                        CustomerAddress["line1"] = HomeAddress[0];
                                        CustomerAddress["line2"] = HomeAddress[1];
                                        CustomerAddress["line3"] = HomeAddress[2];

    Haris Adil e-BizSoft

    Friday, January 18, 2013 10:26 AM
  • thanks vikram

    this will be working fine


    Ravideep Bansal

    Monday, January 21, 2013 8:50 AM
  • Hi Vikram ,

                  can you tell using REST endpoint how can i add new customeraddress to contact entity ? Thanks..

            

    Monday, February 25, 2013 4:09 AM
  • Hi Murali,

    I have't tried to create customeraddress using REST Endpoints. 

    Please check the following links and try to create customeraddress

    http://garethtuckercrm.com/2011/02/15/creating-crm-records-from-jscript-in-2011using-the-rest-end-point/

    http://msdn.microsoft.com/en-us/library/gg334427.aspx


    Hope this helps. If you get answer of your question, please mark the response as an answer and vote as helpful !
    Vikram !

    Monday, February 25, 2013 4:38 AM