GPGVM
GPGVM

Reputation: 5619

Custom Command Display Quick Create Form

I am able to add commands, buttons, etc. to the ribbon just fine so that is not relevant to this question. I open a new record using this javascript (fired by a custom command attached to a custom button)

function ABCD_createContact()
{
 var parameters = {};
 parameters["formid"] = "1FED44D1-rest of guid";
 Xrm.Utility.openEntityForm("contact", null, parameters);
}

I can create many different forms and get the guid of each form and use that guid in the "formid" parameter and it will open/create a new record using that form.

So now I want to open a quick create form. Eventually the idea is to be able to open my custom quick create forms but one step at a time means I'll open an OOB form so I'm using the Contact Quick Create.

Well thinking perhaps Msoft performs some magic behind the scenes and recognizes a quick create I tried changing the formid parameter to the guid of the quick create.

Side Note: I obtained the ID for the quick form using frames[1].Xrm.Page.data.entity.getId() but then verified by checking the SystemFormBase table in the database.

GetID() returned "D7B30CB9-2DA6-E311-93FE-000C293CE5CF" which I couldn't find anywhere. SystemFormBase or UserFormBase?

SystemFormBase says "661157FE-2FC9-4EAA-835F-5BFA2F7B64F7" so I went with that.

So again to be clear what I did was use the SystemFormBase guid for the formid in the above javascript.

This did not work. It did nothing and there was no error. So I tried the D7b30 guid and that didn't work either. It did nothing and there was no error.

So then I captured the url Msoft uses when they open a Quick Create Form and came up with:

http://localhost/org/_forms/read/page.aspx?_CreateFromId=%7bD7B30CB9-2DA6-E311-93FE-000C293CE5CF%7d&_CreateFromType=1&_searchText=&etc=2&hidecommandbar=true&setLastViewed=false&showglobalquickcreate=true

So my question is how do I go about opening a quick create form. Do I use an open url action and pass all the above parameters? Do I use the javascript action and add the url parameters to the parameter array like I do with formid?

Any help would be appreciated!!

Upvotes: 1

Views: 1169

Answers (1)

Joseph Duty
Joseph Duty

Reputation: 795

frames[1].Xrm.Page.data.entity.getId() will get you the record GUID not the form GUID (not sure what frames[1] is, but assuming you are framing in a CRM record).

Also, depending on what version of CRM you are on, there is an Xrm.Utility.openQuickCreate() method. Use that if you are on 2015 Update 1 or later. If you're using CRM 2013, you can do it unsupported, http://ma.xim.is/2014/12/10/open-a-dynamics-crm-2013-quick-create-form-using-javascript/

Another easier option would be just to create an html web resource that acts like a form and uses REST or SOAP to create a record - that is fully supported in every modern version of CRM.

Upvotes: 1

Related Questions