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); } }
↧