CRM 2013 – Let XRM.Utility.OpenEntityForm open CRM forms for you

I wrote a blog post about creating a creating a new record with Javascript and then opening this new record by dynamically creating a url and then some problems I had with that and whilst reading about my trials and tribulations with JavaScript and bugs,  Brian Bayes sat me down (virtually), gave me a cup a tea and said “Hosk, stop all this hurrying and scurrying around, creating dynamic urls, why don’t you just use my good buddy Xrm.Utility.openEntityForm to do all that tricky stuff” and then gave me one simple line to do the method I had written.

Brian didn’t actually use those words but left me  a comment in linkedin saying this function would have have help but that wouldn’t have been as amusing.

So I looked into Brian’s suggetion and by gum he was right.

Initially I thought it was only available in CRM 2013 but they snuck it in during CRM 2011 rollup 8, which shows you the benefit of reading what useful things are in the rollups.


You can also pass in parameters you want to set on the form

var parameters = {};
parameters["formid"] = "b053a39a-041a-4356-acef-ddf00182762b";
parameters["name"] = "Test";
parameters["telephone1"] = "(425) 555-1234";
Xrm.Utility.openEntityForm("account", null, parameters);

The Xrm.Utility object provides a container for useful functions not directly related to the current page. This object was added in Microsoft Dynamics CRM 2011 Update Rollup 8.

var newWindow = Xrm.Utility.openEntityForm("contact");
  • e helped you here?47m ago
  • Ben HoskingBen Hosking Everyday is a school day. Although the project I was working on was CRM 2011 so I’m not sure that would have worked.44m ago

  • Brian BayesBrian Bayes Ah I see, Xrm.Utility has been tucked away since CRM 2011 Rollup 8 and I only discovered it a couple of months ago to be honest.32m ago

  • Ben HoskingBen Hosking knowing that would have saved me at least an hour mucking about with the bug and getting the url correct. Great comment, cheers.

6 thoughts on “CRM 2013 – Let XRM.Utility.OpenEntityForm open CRM forms for you

  1. Joel May 19, 2017 / 6:17 pm

    Is it possible to get the ID of the record that would be created on the new form from the parent form?


  2. Luis February 19, 2018 / 11:11 am

    Thanks for that!
    I was trying to use that but when closing that record, refresh the form that opened that window…can’t seem to find a solution.
    Any ideas on that?



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.