Hi all,
I have unsuccessfully tried to change the form of a record from a custom entity based on the value of an option set :-D...
Let me explain.
I have a custom entity with 3 different forms named "Phase 1", Phase 2" and "Phase 3".
On each of these forms there is an option set with the values "Phase 1", Phase 2" and "Phase 3".
Now I need to manage to change the record's form based on that option set. So when I chose "Phase 2" on the option set I want to have form "Phase 2" automatically loaded and so on...
Of course I have actively searched the web and this forum, but none of the suggested solutions did the trick.
Here is what I tried last ans what I found the best approach:
function showForm() {
// variable to store the name of the form
var lblForm;
// get the value picklist field
var relType = Xrm.Page.getAttribute("eura_nwm_phaseneu").getValue();
switch (relType) {
case 1:
lblForm = "Phase 1";
break;
case 2:
lblForm = "Phase 2";
break;
case 3:
lblForm = "Phase 3";
break;
default:
lblForm = "Phase 1";
}
//check if the current form is form need to be displayed based on the value
if (Xrm.Page.ui.formSelector.getCurrentItem().getLabel() != lblForm) {
var items = Xrm.Page.ui.formSelector.items.get();
for (var i in items) {
var item = items[i];
var itemId = item.getId();
var itemLabel = item.getLabel()
if (itemLabel == lblForm) {
//navigate to the form
item.navigate();
} //endif
} //end for
} //endif
}//endif
Can someone assist me :-)?
Thanks in advance!