locked
CRM 2011: Load a Form by Id RRS feed

  • Question

  • I'm trying to create a unique form for the create versus the update of an entity.  So I have two forms for a custom entity. I added a new custom "New" button that will fire off JavaScript when creating a new record.  If the user clicks on an existing record, it will just load the default form for the entity. So I want to use JavaScript for the button to call this form.  But I'm having some trouble getting the button to use the new form and not the default form.

    I'm hoping someone has ran across this sort of need and might be able to tell me what I am doing wrong.

    Here's the code I have in a function that fires from the button click.  The button works fine, the code just continues to load the default form, not my the new create form.

    var parameters = {};
    parameters["formid"] = "3bd90f70-11d0-4476-921c-b32261fcb4e4";            
    Xrm.Utility.openEntityForm("new_hbc", null, parameters);

    This doesn't work!  It may be that my form id is incorrect. To get this, I opened the form to view the short form (set it up to show it to me based on a security role I setup just to see the form) and I copied the link via "Copy a link" button.  Here's what that link looks like:

    <...../main.aspx?etc=10006&extraqs=formid%3d3bd90f70-11d0-4476-921c-b32261fcb4e4&id=%7bEA10209F-C645-E411-AA0A-00155D1C2871%7d&pagetype=entityrecord>

    So, what's the form id?  I've tried just about every pattern I can think of around not including the %3d, %, %3, etc. trying to figure out what is needed, but nothing works.

    Is this a valid way to open one of the non-default forms? I just have a unique form for the create.  v

    Any idea what I am doing wrong?


    Jon Gregory Rothlander


    Monday, February 9, 2015 6:12 PM

Answers

  • The issue came down to correctly capturing the GUID.  Once I had the correct GUID it worked fine.

    Jon Gregory Rothlander

    • Marked as answer by jonrothlander Friday, March 6, 2015 8:20 PM
    Friday, March 6, 2015 8:20 PM