Composite Fields In MSCRM 2013 RRS feed

  • Question

  • Hi there.

    I have a question on the subject of composite attributes that I would be grateful if you could help me with.

    I am writing JavaScript that will update the fields (i.e. address1_line1, address1_line2, address1_line3, address1_city, address1_stateorprovince, address1_postalcode, address1_country) in the composite (address1_composite). When the fields are updated the composite does not seem to update. I have to open the composite and close it again. Is there a way of doing this automatically in JavaScript?

    What would be great is if there was a way to fire the composite done button in JavaScript.

    I have tried the following:


    This is not any good as my customers want to view the composite before saving the page. Also I would not want to save the page for my customers as they do not want this.



    This is not really what I wanted as I do not want to refresh the whole page. I just want to refresh the composite. Also it bring up a popup that warns you about not having saved the page which will be annoying for my customers.


    Writing the address from the address lines to the composite.

    This feels like a nasty hack.

    There is probably more than one way of doing this. I used the function Xrm.Page.getAttribute("address1_composite")._attribute.setValueForCompositeField() however this is a bit of a hack and it requires me to write extra code for each form that has a composite which has fields with different schema names. E.g. I have to write different code for forms with ShipTo and BillTo addresses as the code for the account form will not work. In the future if customers are allowed to add their own composite fields it could cause problems.





    Oliver Folarin.

    Wednesday, January 15, 2014 11:43 AM

All replies

  • hi,

    As for customizing the existing composite controls, we also cannot add, remove, or modify fields in the fly-out menus through the UI. This means that for us New Zealanders where we don’t use the ‘State’ address field, we cannot easily remove that from addresses now, or even relabel the fields. Hopefully this is also made editable in the future through the UI.

    Friday, January 17, 2014 10:50 AM
  • Hi sailusha g.

    Thanks for you reply.

    What I wanted to know is if there was a way for the composite window to be updated from the different composite values in it? I.e. If the address has been filled in for address1_line1, address1_line2, address1_line3, address1_city, address1_stateorprovince, address1_postalcode, address1_country can the composite window address1_composite be updated. That is can I force an update of the composite window from JavaScript.


    Friday, January 17, 2014 11:03 AM
  • Friday, January 17, 2014 11:57 AM
  • Hi Sailusha.

    Thanks again for trying.

    I have actually read these articles and the one below in your next post. 

    In section 3. Setting the value of a field inside the fly-out menu using JavaScript

    It states the problem I am having.

    The composite field won’t be updated until you open the fly-out menu, and then close it again. You can also perform a save (or wait until the auto-save kicks in) and then the composite field will be updated.

    However the solution it gives is to use save or wait for auto save to kick in.

    As I described in my original post this is not an acceptable solution for what I am trying to do.



    • Edited by Oly2010 Friday, January 17, 2014 12:16 PM
    Friday, January 17, 2014 12:15 PM
  • Hi Sailusha.

    Thanks for this.

    However this link also recommends using save which as I described above is not adequate for my customers.



    Friday, January 17, 2014 12:19 PM