priyeshwagh777
priyeshwagh777

Reputation: 63

Issue with using Xrm.Utility.openQuickCreate() from HTML web resource

I'm trying to open an entity's Quick Create form from an HTML web resource from navigation of an entity. I'm using Xrm.Utility.openQuickCreate("entityname", null, null) for a start.

I get an error saying JQueryApi is not defined in the browser's console.

However, other functions like Xrm.Utility.openEntityForm and Xrm.Utility.isActivityType(entityname) does work.

Any suggestions? Thanks.

Upvotes: 0

Views: 814

Answers (2)

Red Knight 11
Red Knight 11

Reputation: 127

@Polshgiant - Thank you! I was having this exact issue, and even though I had referenced the parent entity id correctly, I didn't do the same for the openQuickCreate call. I only wish I had found this answer 10 hours ago. Here's my complete code, in case anyone needs it (or can offer suggestions how to improve it):

function YOURFUNCTIONNAME() {
            var parentContact = {
                entityType: "contact",
                id: window.parent.Xrm.Page.data.entity.getId().substring(1, 37)
            };

            // You can set parameters here to pre-fill the form; I haven't
            var parameters = {

            };

            parent.Xrm.Utility.openQuickCreate("YOURLOGICALENTITYNAME", parentContact, parameters)
                .then(function(lookup) { successCallback(lookup); }, function(error) { errorCallback(error); });

            function successCallback(lookup) {
                alert("lookup: " + lookup.savedEntityReference.id);
                alert("lookup: " + lookup.savedEntityReference.name);
            }

            function errorCallback(e) {
                alert("Error: " + e.errorCode + " " + e.message);
            }
        }

Upvotes: 0

Polshgiant
Polshgiant

Reputation: 3664

Try reaching up into the parent form to call the method: parent.Xrm.openQuickCreate("entityname", null, null)

Upvotes: 1

Related Questions