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

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Xrm.Page.ui.getFormType() returns wrongly after initial save.

(0) ShareShare
ReportReport
Posted on by

I am recently noticing a problem with CRM online  with code that previously worked.

If Xrm.Page.ui.getFormType() is called in onload event scripts, functions called by onload event or even soon thereafter following the initial save of a CRM record the wrong value is returned.  The value 1 of create form is being returned after save so value 2 should be returned. 

If Xrm.Page.ui.getFormType() is delayed or called subsequently to other code the correct value of 2 is returned.

This seems to be a recent bug. 

*This post is locked for comments

I have the same question (0)
  • Rafael Batista Profile Picture
    on at
    RE: Xrm.Page.ui.getFormType() returns wrongly after initial save.

    Hello everybody,

    The only workaround I found for the moment is to check the disabled state on another field where you are pretty sure it will be disabled if the form is in Read-Only mode:

    if ( Xrm.Page.getControl(arg).getDisabled() == true)

    {

    //Form State is in read-only

    }

  • MohamedRamadan Profile Picture
    on at
    RE: Xrm.Page.ui.getFormType() returns wrongly after initial save.

    Hello,

    We are also facing the same issue on Microsoft Dynamics 365 Version (8.2.2.112) On-premise, Xrm.Page.ui.getFormType() is returning 2 (update) even the form is a Read-only.

    Any updates or workarrounds for this?

    Thanks,

    Mohamed Ramadan

  • Rafael Batista Profile Picture
    on at
    RE: Xrm.Page.ui.getFormType() returns wrongly after initial save.

    Hello guys,

    I am also facing the same issue. I am running a Microsoft Dynamics 365 Version (8.2.2.112) On-premise.

    In some cases, Xrm.Page.ui.getFormType() is returning 2 (update) even on a Read-only form.

    Do you guys have any update ?

    Regards,

    Rafael

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Xrm.Page.ui.getFormType() returns wrongly after initial save.

    I am having the same issue.

  • Community Member Profile Picture
    on at
    RE: Xrm.Page.ui.getFormType() returns wrongly after initial save.

    Hi Alex,

    Thanks for your reply.  I appreciate the work around is possible, thanks.  I was more looking to understand if this had been acknowledged as a bug.

    .getFormType() has been used since CRM v4  for me and is quite fundamental in from operations so should be reliable.  I  should I suppose of taken this up this MS directly.

    None the less thanks for your suggestion.

    Interesting point,  As of now 13/10/2017 08:00(UK)  Forms for Opportunity and Account implementing .getFormType() in load event are returning correctly!

    I will continue to monitor and update.

    Regards,

    Simon

  • Suggested answer
    ashlega Profile Picture
    34,477 on at
    RE: Xrm.Page.ui.getFormType() returns wrongly after initial save.

    Hi,

     this is probably the reason why they are using a different approach even in the dynamics team blogs:

    (Xrm.Page.data.entity.getId() == null || Xrm.Page.data.entity.getId() == ‘undefined’ || Xrm.Page.data.entity.getId() == ”)

    blogs.msdn.microsoft.com/.../set-default-business-process-on-a-form-while-creating-new-record

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…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#2
Christoph Pock Profile Picture

Christoph Pock 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans