locked
copy account details RRS feed

  • Question

  • CRM2013

    In accounts we are using address1 fields for a company address and address2 fields for a billing address. Is there a way to add a button to copy the details from address1 fields into address 2 fields, as in most cases the company address and billing address are the same ?


    Dont ask me .. i dont know

    Wednesday, November 6, 2013 11:13 AM

Answers

  • hey man, say 1,2,3 your tasks is done now. just follow these step:-

    1. Create 'Two Option' field. Set its options like copy or same. copy for copy the data and left the same is default.
    2. Now create a .js library with the following function. at the on-Change event of the two option field.
    3. function SetStringField()
      {
      var adress1= Xrm.Page.data.entity.attributes.get("new_address1").getValue();
      var adress2= Xrm.Page.data.entity.attributes.get("new_address2");
      adress2.setValue(adress1);
      }

    Now, feel and enjoy!!!



    • Edited by Mohsin__ Wednesday, November 6, 2013 1:09 PM
    • Marked as answer by Pete Newman Monday, November 25, 2013 2:28 PM
    Wednesday, November 6, 2013 12:54 PM

All replies

  • No matter whether you are working with CRM2013 Online or On-Premise. Yes, you can add a new button in the Account ribbon "Copy To Billing Address". You can use VisualRibbonEditor available on CodePlex to add new button.

    Write javascript function to copy details of the each field of Address1 to each field of Address 2. For more details of how to bind the new button with the javascript function you can also refer to this MSDN article.

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

    Further you can keep Address2 (Billing Address) fields as editable in case user need to change their billing address.

    Hope this helps.


    Ajay Chawla

    Wednesday, November 6, 2013 11:38 AM
  • since all fields are on form, this will be a simple implementation:

    1. create a js library with your custom method which should read the source address fields and populate the destination address fields(see SDK js sample code or just google how to read and set form attributes)

    2. upload the js library as web resource

    3. Use visualribboneditor or a similar tool (google it) and create a button. Set the button to call your custom method in your custom js library(created in step 1) and you'll be good to go.

    It may look like a lot of work(exploring and doing it yourself) to do but will make you feel good rather than copying the whole solution frm smwhere.


    - Arvind

    Wednesday, November 6, 2013 11:39 AM
  • hey man, say 1,2,3 your tasks is done now. just follow these step:-

    1. Create 'Two Option' field. Set its options like copy or same. copy for copy the data and left the same is default.
    2. Now create a .js library with the following function. at the on-Change event of the two option field.
    3. function SetStringField()
      {
      var adress1= Xrm.Page.data.entity.attributes.get("new_address1").getValue();
      var adress2= Xrm.Page.data.entity.attributes.get("new_address2");
      adress2.setValue(adress1);
      }

    Now, feel and enjoy!!!



    • Edited by Mohsin__ Wednesday, November 6, 2013 1:09 PM
    • Marked as answer by Pete Newman Monday, November 25, 2013 2:28 PM
    Wednesday, November 6, 2013 12:54 PM