As you can have multiple forms in Microsoft Dynamics CRM you may wish to navigate to a particular form from JavaScript.
The function below can be used to change the currently selected form.
ChangeForm("Test Form");
function ChangeForm(formName) { var currentForm = Xrm.Page.ui.formSelector.getCurrentItem(); var availableForms = Xrm.Page.ui.formSelector.items.get(); if (currentForm.getLabel().toLowerCase() != formName.toLowerCase()) { for (var i in availableForms) { var form = availableForms[i]; // try to find a form based on the name if (form.getLabel().toLowerCase() == formName.toLowerCase()) { form.navigate(); return true; } } } }
hi neil,
is this workimg withe actual forms (turbo) too?
thx, greets peb
LikeLike
Hi Peb, I have actually only used this with “normal” forms. (Turbo). I don’t have legacy forms enabled in my CRM instance!
Thanks
Neil.
LikeLike
hi Neil
i have a related question , i you could answer it please.
I have a custom activity entity that has several forms.
when the users add a new activity the “regardingobjectid” attribute is set correctly, but if the user switches from the current form to a different form, the the “regardingobjectid” attribute is lost when the form reloads.
the same bug happens on vanila activities (appointment).
Is there a solution or a work around?
thanks in advance.
Doron
LikeLiked by 1 person
Hi Doron
Hard to be sure as I’d need to look deeply into your config!
I am going to guess that the regardingobjectid field has been populated but the record not saved.
Try saving before you change the form. If you find this works (manually) you may find the config isn’t simple. It will be possible but you will need to only change the form after the save has finished! (Running a save action can start the save but doesn’t tell us when complete! You can try adding something to the saved event but I’ve had mixed success with that!)
Good luck
Neil.
LikeLike