Object doesn't support property or method 'setFormMode'

Answered Object doesn't support property or method 'setFormMode'

  • Friday, April 13, 2012 12:10 PM
     
     

    Hi all,

    I have installed the last rollup (7) in CRM 2011. And I received the following issue:  "Object doesn't support property or method 'setFormMode' " in all edit forms(opened from code).

    Is it possible to fix? or it default bug in rollup 7?

     

All Replies

  • Friday, April 13, 2012 12:37 PM
    Answerer
     
     

    Hi Sergey,

    I've never seen any documented method named 'setFormMode' where is this call being made from - is it from some of your custom javascript - or somewhere else?

    Scott


    Scott Durow
    Read my blog: www.develop1.net/public
    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

  • Friday, April 13, 2012 12:44 PM
     
      Has Code

    Hi Scott,

    I do not call this method. I use example(Open Forms, Views, and Dialogs with a URL  from doc sdk) for open edit entity form. this method called  in the edit form.

    function SETFORMMODE()
    {
    masterWindow().setFormMode(10010,'Edit');
    }


  • Friday, April 13, 2012 1:14 PM
    Answerer
     
     

    Hi,

    To open a form in edit mode you need to open a url in the following format:

    http://servername/org/main.aspx?etn=<entityname>&pagetype=entityrecord&id=%7B....%7D

    You don't need any javascript.

    hth,

    Scott


    Scott Durow
    Read my blog: www.develop1.net/public
    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

  • Friday, April 13, 2012 1:19 PM
     
     
    Thanks, but i know about it. I do not use any javascript method. . This error occur only in the default crm edit form.  
  • Friday, April 13, 2012 1:29 PM
    Answerer
     
     

    Sorry - now I understand - it looks like this is new in UR7 as you say.

    I suspect this is because you have old versions of JavaScript cached. Try clearing down your temporary internet files.

    hth,

    Scott


    Scott Durow
    Read my blog: www.develop1.net/public
    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

  • Friday, April 13, 2012 1:35 PM
     
     
    I have tried it, but unfortunately it doesn't help.
  • Friday, April 13, 2012 2:33 PM
    Answerer
     
     

    Hi,

    I suspect that there is a proxy server somewhere catching the files then. The new function is in global.ashx.

    If you open a CRM form in IE and press F12, you'll get the developer window. If you select Script and then on the hammer and screwdriver icon drop down select 'Format Javascript'. Then in the top right, type 'function setFormMode(etc,mode)' and click search. You should see a function:

    function setFormMode(etc,mode){
        Mscrm.CrmWindow.$1z_0[etc]=mode
    }

    If not, then your global.ashx javascript is being cached somewhere along the line. 

    hth,

    Scott


    Scott Durow
    Read my blog: www.develop1.net/public
    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"


  • Friday, April 13, 2012 2:43 PM
     
     

    Hi,

    Yes, I have found this method in javascript code. But method(setFormMode) does not  call.

  • Friday, April 13, 2012 2:51 PM
    Answerer
     
     

    Does it only happen when you open from code?

    If so, can you post the url that you are using to open with.

    Scott


    Scott Durow
    Read my blog: www.develop1.net/public
    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

  • Friday, April 13, 2012 3:08 PM
     
     

    Yes, it happen only when i open from code.

    https://crmsrv.master.****.info/****Master/main.aspx?etn=***task&id=%7b9e000cde-7279-e111-9669-000c2989676a%7d&pagetype=entityrecord

  • Friday, April 13, 2012 3:23 PM
    Answerer
     
     Proposed

    Could you try changing it to:

    https://crmsrv.master.****.info/****Master/main.aspx?etn=***task&id=%7b9e000cde-7279-e111-9669-000c2989676a%7d&pagetype=entityrecord&rof=false



    Scott Durow
    Read my blog: www.develop1.net/public
    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    • Proposed As Answer by Jan_Klode Wednesday, April 18, 2012 7:14 AM
    •  
  • Wednesday, April 18, 2012 7:15 AM
     
     
    This one solved it, thanks
  • Friday, April 20, 2012 7:19 AM
     
     

    the &rof=false tags works fine for on-premise, but doesn't work for CRM online.  The CRM on-line solution continues to work ok without the &rof=false argument (perhaps MS have applied a hotfix to the online version?).  Do you know of a way that works consistently between the two?

    Thanks in advance,

    Simon


    Simon Neve


    • Edited by Simon Neve Friday, April 20, 2012 7:25 AM
    •  
  • Friday, April 20, 2012 8:16 AM
    Answerer
     
     

    Hi Simon,

    Read Only forms was part of UR7 - and last I heard was "For online customers, Update Rollup 7 for Microsoft Dynamics CRM 2011 will be applied to production servers in early April 2012".

    So for now, you'll have to omit the &rof bit for CRM Online until UR7 has been released.

    hth,

    Scott


    Scott Durow
    Read my blog: www.develop1.net/public
    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

  • Friday, April 20, 2012 9:05 AM
     
     

    Thanks Scott for the quick response.

    Read Only Forms - of course!

    I've checked the version of CRM online and the version is  5.0.9690.2165 (Db) 5.0.9690.2165.  Looking at this page ...

    http://support.microsoft.com/kb/2555051

    ... it seems that RU7 has been applied to CRM online?

    Can code around for now - surprised this hasn't affected more people though.

    Simon


    Simon Neve

  • Friday, April 20, 2012 6:34 PM
     
     
    I'm getting this same issue, but I'm not opening the page from code, I'm just clicking on a link on a custom entity subgrid (both parent & child are custom entities).
    Clearing the cache didn't solve the problem.
  • Thursday, April 26, 2012 4:02 PM
     
     

    Hi,

    we are getting this errror within records URLS inserted in emails via Workflow.

    We use the standard CRM capability that permits you to insert in an email generated within a workflow a link to a record related to the enetity that triggered the workflow or the record itself (see image).

    Since we use all supported customization I think that this can be considered a bug introduced with the rollup 7.

    URL in workflow

    Marco

  • Thursday, April 26, 2012 6:19 PM
     
     
    We see this same issue with UR7 and reports that hyperlink to CRM records.
  • Wednesday, May 02, 2012 1:58 PM
     
     
    We are having this issue using the Outlook client.  Does anyone know what we can do to resolve please?  Working through browser does not generate the same errors.

    Sue Neilson Sovereign Business Integration plc


    • Edited by SueNeilson Wednesday, May 02, 2012 2:02 PM
    •  
  • Tuesday, May 15, 2012 2:06 PM
     
     Answered
    The issue was fixed in the last rollup(8)!
  • Tuesday, May 15, 2012 11:25 PM
     
     
    Great! I am glad to hear that.  Thanks for reporting this, Sergey!
  • Wednesday, June 06, 2012 6:18 AM
     
     

    Hi All,

    Script because of ROF. so if we use Window.Open('Case Link') then this will have problem with script loading and associated activities.

    for that we need to accces CRM context and use window.parent.opener.openStdWin(url, name, customWinFeatures); method
    for opening.

    It worked for me.

    Regards,
    Kannan

  • Monday, June 11, 2012 12:31 PM
     
     

    Just installed rollup 8 and this problem still exists! Any other solutions than to use the parent window? 

    It works to use the parent window, but what if the parent window has been closed?

    Regards,

    Danny

  • Tuesday, June 26, 2012 2:32 PM
     
     

    Could you try changing it to:

    https://crmsrv.master.****.info/****Master/main.aspx?etn=***task&id=%7b9e000cde-7279-e111-9669-000c2989676a%7d&pagetype=entityrecord&rof=false



    Scott Durow
    Read my blog: www.develop1.net/public
    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    Thank you this also resolved my issue.

    Kelvin


    Kind regards, Kelvin

  • Thursday, July 05, 2012 5:34 AM
     
     

    With rollup 7 and 8, it wasn't fixed on our CRM.

    And with '&rof=false', the error didn't occur anymore but records in the sub grid of the opened window are not able to be opened somehow.

    But I solved this problem in my own way.

    I guess that this problem is causes by existing the parent window which is not Dynamic CRM's window.

    When the record is opened, the opened window try to call a method or something which the parent window is supposed to have.

    Either way, my guessing is right or not, the following step would work fine.

    1. open the dummy window

    2. open the record from the dummy window

    3. close the dummy window.


    Taichi,Sato


    • Edited by dora_san Thursday, July 05, 2012 5:37 AM
    •  
  • Monday, July 16, 2012 11:24 AM
     
     

    With rollup 7 and 8, it wasn't fixed on our CRM.

    And with '&rof=false', the error didn't occur anymore but records in the sub grid of the opened window are not able to be opened somehow.

    But I solved this problem in my own way.

    I guess that this problem is causes by existing the parent window which is not Dynamic CRM's window.

    When the record is opened, the opened window try to call a method or something which the parent window is supposed to have.

    Either way, my guessing is right or not, the following step would work fine.

    1. open the dummy window

    2. open the record from the dummy window

    3. close the dummy window.


    Taichi,Sato


    Thank you so much. This seems to work perfectly.

    Hope that MS would fix this in some future rollup.

    Regards,

    Danny

  • Monday, July 16, 2012 9:57 PM
     
     

    I'm still seeing this problem.  In my scenario, I have a web resource that uses window.open() to create a new record. 

    Looking at the javascript in the child window there are these lines

    ...

    var wndToCheckForPreload = window._masterWindow ? window._masterWindow : window.opener;

    ...

    function SETFORMMODE()
    {
       masterWindow().setFormMode(10041,'Edit');
    }

    ...

    As Dora_san suggested, the child form is trying to call a functinon on the window.opener.

    Putting a dummy function in the parent web resource works for me and avoids the error being thrown.

    // Unused function to ignore error with setFormMode bug

    // Called by child forms

    function setFormMode(UnusedNumber, UnusedValue) {

    // Ignore

    }



    Simon Neve

  • Tuesday, July 31, 2012 9:15 AM
     
     

    This is fantastic finding. This works for me. So for me it looks as a bug in the rollup and it needs to be fixed. or is anyother settings to be done at server side to prevent this issue ?

    -Kolappan

  • Thursday, October 04, 2012 10:27 AM
     
     
    I still get this error on a rollup 8 server. Cache cleared, IIS reset etc etc. Scott Durow's suggestion of &rof=false was the solution for me.

    Paul Dowman, CRM Developer

  • Monday, October 22, 2012 1:28 PM
     
     

    This - very annoying - problem still exists in UR8. I've forms with subgrids, which causes script a script error because of setFormMode.

    My Solution (like Simon Neve suggested):

                var w = window.open(url, '_blank', opts);

                // DIRTY FIX 
                w.parent.opener.setFormMode = function () { };