web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Error : Invalid operand to 'in': Object expected in JavaScript in CRM2013

(0) ShareShare
ReportReport
Posted on by

Hi All,

I am trying to obtain the form type by using Xrm.Page.ui.getFormType().

But it is throwing an exception.

"Invalid operand to 'in': Object expected"

Can someone please help to resolve this.

Thanks and Regards

Mahendra Nagappa

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    hi

    follow the link to get form type in crm

    mehmetgunen.com/get-form-type-in-crm-2013-using-javascript

    mark verified if it finds useful to solve your query

    Regards

  • Community Member Profile Picture
    on at

    Hi Guido please find the snippet

    CRM is throwing xception when it executes Xrm.Page.ui.getFormType()

    function wi_lostcompetitor_onChange()

    {

       var closure_type = Xrm.Page.getAttribute("wi_closuretype").getValue();

       if (closure_type == '2' &&  Xrm.Page.ui.getFormType()== 2) {

           alert("Please Save the Opportunity to process for Close Lost.The Status will get changed after 2 mins.");

       }

    }

  • Community Member Profile Picture
    on at

    follow the link

    msdynamicscrmblog.wordpress.com/.../get-form-types-and-modes-in-dynamics-crm-2013

    is the form type is update

    function wi_lostcompetitor_onChange()

    {

    var test = Xrm.Page.ui.getFormType();

      var closure_type = Xrm.Page.getAttribute("wi_closuretype").getValue();

      if (closure_type == '2' && test  == 2) {

          alert("Please Save the Opportunity to process for Close Lost.The Status will get changed after 2 mins.");

      }

    }

    regards

  • Community Member Profile Picture
    on at

    Hi Nithin

    We tried this. It was throwing exception.

  • Community Member Profile Picture
    on at

    Do you have any other scripts on form? Try to disable them and check form type. If it works then enable scripts one by one. Maybe some of them is causing issue.

  • Community Member Profile Picture
    on at

    debug and find which line it throws an error, please schare the screen grab of error

    Regards,

    Nithin

  • Felippe Profile Picture
    796 on at

    Check the code of your libraries loaded for this form and the order of them.

    Maybe your error are not related to the form type.

    Use the F12 Developer Tools to Debug this and indetify the problem.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans