Hi Jacob,
The following code should do the trick. You will need to tweak it a bit to meet your specific requirements, but it should set you on the right track!
function switchToCorrectForm() {
var formName = "information";
var myOption = Xrm.Page.getAttribute("myoptionset").getValue();
if (myOption == 100000000) {
formName = "customform1";
}
else if (myOption == 100000001) {
formName = "customform2";
}
var currentForm = Xrm.Page.ui.formSelector.getCurrentItem();
var availableForms = Xrm.Page.ui.formSelector.items.get();
// If we are already on the form, we don't need to change forms
if (currentForm.getLabel().toLowerCase() != formName.toLowerCase()) {
for (var i in availableForms) {
var form = availableForms[i];
if (form.getLabel().toLowerCase() == formName.toLowerCase()) {
form.navigate();
}
}
}
}
If this has helped you, please mark as answer, or reply if you need more information. :)
~ Atomic Coder