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
*This post is locked for comments
Tell me one thing, once user select optionset value at that time only new window will be opened, right. Before opening the new window can you write single line to setfocus to another field on the form or the field next to option set.
Xrm.Page.ui.controls.get("FieldName").setFocus();
Thanks,
Rahul
Hi Rahul,
Firstly, thank to answer.
Then, How do I make it possible? How do I try to remove the focus by javascript? Because the user remove the focus when he clicks on anywhere of the screen. But this action isn`t a answer.
thanks
Hi,
Once you closed the child window try to remove the focus from optionset then it will get closed.
Regards,
Rahul
André Arnaud de Cal...
291,965
Super User 2025 Season 1
Martin Dráb
230,836
Most Valuable Professional
nmaenpaa
101,156