Quantcast
Channel: CRM Development forum
Viewing all articles
Browse latest Browse all 8223

Composite Fields In MSCRM 2013

$
0
0

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:

 Xrm.Page.data.entity.save();

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.

 

Xrm.Page.data.refresh();

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.

 

 

 

Cheers.

Oliver Folarin.


Viewing all articles
Browse latest Browse all 8223

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>