locked
crmForm.FormType Undefined RRS feed

  • Question

  • I have a script that checks for if(crmForm.FormType == 1). Everything works fine when I am logged in as the system administrator. However, when I am logged in as a full access user (read & write) then crmForm.FormType is undefined. I double checked this with alert(crmForm.FormType). crmForm.all is defined for both but not crmForm.FormType. Why is the behavior for this different depending on the user that is logged in?

    Tuesday, September 24, 2013 6:42 PM

Answers

  • Hi,
    if you are using CRM 2011 I suggest to change your sintax to the supported method.

    Instead of crmForm.FormType you need to use

    if (Xrm.Page.ui.getFormType() == 1) {
    // ...
    }

    if you are using CRM4, the behavior you described is very strange.


    My blog: www.crmanswers.net

    • Marked as answer by hfaun Tuesday, September 24, 2013 9:17 PM
    Tuesday, September 24, 2013 8:48 PM

All replies

  • Hi,
    if you are using CRM 2011 I suggest to change your sintax to the supported method.

    Instead of crmForm.FormType you need to use

    if (Xrm.Page.ui.getFormType() == 1) {
    // ...
    }

    if you are using CRM4, the behavior you described is very strange.


    My blog: www.crmanswers.net

    • Marked as answer by hfaun Tuesday, September 24, 2013 9:17 PM
    Tuesday, September 24, 2013 8:48 PM
  • Guido, I do use CRM 2011 and what you mentioned above did work. I also had to change the way I did set the lookup field, i.e. Xrm.Page.getAttribute(attributename).setValue(lookup).

    I am still puzzled why my original code worked just fine for me (administrator) but not for other users. I even checked it on different computers with the same behavior.

    Tuesday, September 24, 2013 9:17 PM