Javascript – Form Navigate

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()) {
        return true;

2 thoughts on “Javascript – Form Navigate

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s