Quantcast
Channel: Microsoft Dynamics CRM
Viewing all articles
Browse latest Browse all 71679

Forum Post: RE: JavaScript to copy a Lookup Field into a Free Text Field

$
0
0
I don't know enough aboutt JavaScript to get this right. Below is the JavaScript we use to convert a Country Pick List value into text. I think it is pretty general anc can be used to convert any Pick List value into text. Under each line I have written what I think you may be suggesting converting a Country record lookup into text. (The primary field in the Company record is bmt_countryname). Have I got this right please? function copyOptionsetField(passFieldName, copyFieldName) { function copyListField(passFieldName, copyFieldName) { if (Xrm.Page.getAttribute(passFieldName).getValue() != null) { if (Xrm.Page.getAttribute(passFieldName).getValue() != null) { var picklistValue = Xrm.Page.getAttribute(passFieldName).getText(); var listText = Xrm.Page.data.entity.attributes.get("bmt_countryname").getValue()[0].name; Xrm.Page.getAttribute(copyFieldName).setValue(picklistValue); Xrm.Page.getAttribute(copyFieldName).setValue(listText); } }

Viewing all articles
Browse latest Browse all 71679

Trending Articles



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