locked
How to Disable or hide the form name in Form Selector RRS feed

  • Question

  • Hello Experts, I would like to hide or disable the form name inside form selector. For that i am doing as below.

    function hideAddInfoForm()
    {
    var addFormId="9ff2b534-0731-4a94-94d3-883d4f4d951e";
    var items = Xrm.Page.ui.formSelector.items.get();
     for (var i in items) {
      var item = items[i];
      var itemId = item.getId();
      if (itemId == addressFormId) {
      item.setDisabled(true);
         }
      }
    }

    i am getting error that the setDisabled() method is not supported. I checked there is no such method for this object.

    i can hide the selector but i want to navigate other forms also except only one form.

    Please suggest how i can do it.

    Thank you


    saroj

    Friday, August 2, 2013 5:57 AM

All replies

  • Hi, what is the reasoning behind not using security roles to grant access to the form? As in why are you hiding the form with JavaScript instead of just not assigning certain security roles to that form?

    I'm not sure that you can remove options, other than from using role based forms.

    Paul


    If my response helped you find your answer please show your thanks by taking the time to "Mark As Answer" and "Vote As Helpful".

    Twitter LinkedIn Facebook Blog Magnetism

    Friday, August 2, 2013 7:43 AM
  • Hello Paul, Thank you for your response. Actually the form i want to hide is opening from another application(HTML App). So when a user will select any form he/she should not see the form i want to hide. The user might have any role. 

    Is there any way to hide or disable the form selector items please suggest.

    Thank you


    saroj

    Friday, August 2, 2013 8:02 AM
  • I don't believe there is any supported way to do this.

    I've been experimenting with some unsupported JavaScript but it's not pretty, something along the lines of this:

    document.getElementById("crmFormSelector").click();
    document.getElementById("9ff2b534-0731-4a94-94d3-883d4f4d951e").style.display="none";

    But you end up with the form selecting being expanding onload which isn't good.

    Another approach could be to have JavaScript running onload of both/all forms to check if the user is on the right form, and if not redirect them to the other form. So basically allow them to change forms, but then have JavaScript send them right back again.

    Hope that helps

    Paul


    If my response helped you find your answer please show your thanks by taking the time to "Mark As Answer" and "Vote As Helpful".

    Twitter LinkedIn Facebook Blog Magnetism

    Friday, August 2, 2013 11:19 AM