Hi everybody!!
I wrote a JavaScript to launch a new window of entity related when the optionset is selected.
There is the code:
function PushLoa() { var tema = Xrm.Page.getAttribute("name").getValue(); var GUID = Xrm.Page.data.entity.getId() var entitytype = "opportunity"; var lookupdata = new Array; var lookupitem = new Object; lookupitem.id = GUID; lookupitem.name = tema; lookupitem.entitytype = "opportunity"; lookupdata[0] = lookupitem; var primaryField = Xrm.Page.data.entity.getPrimaryAttributeValue(); var windowOptions = { openInNewWindow: true }; var parameters = {}; parameters["odm_name"] = "Solicitud para " + tema; parameters["odm_oportunidad"] = GUID; parameters["odm_oportunidadname"] = primaryField; var solicitud = Xrm.Page.getAttribute("odm_solicituddeloas").getText(); if (solicitud == "Solicitada") { Xrm.Utility.openEntityForm("odm_loa", null, parameters, windowOptions); } }
It works as follows:
The user change the optionset field from opportunity entity and the system open new window with this new entity. This new window is filled with the name of the record and with entity related lookup filled (opportunity lookup field). This is OK.
Then user saves and closes the new entity record, and he backs to opportunity entity record. And in this time, the optionset field is open and user have to click on the screen to validate the selected option. In fact, the user can change the option selected on the first time, without it start again the JavaScript.
The question is Can I close the optionset fields with the option selected?
Thank you in advanced