0

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.

priyeshwagh777
  • 65
  • 2
  • 11

2 Answers2

1

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

Polshgiant
  • 3,595
  • 1
  • 22
  • 25
  • Yes, that might work. I haven't tried it yet.I actually didn't want to use parent since it is unsupported. – priyeshwagh777 Nov 04 '16 at 04:56
  • Reaching up to the Xrm API from a web resource via parent is definitely supported (unless they recently changed guidance). If you tried reaching up to the parent and then modifying the DOM or accessing an undocumented part of the API, that would be unsupported. – Polshgiant Nov 07 '16 at 13:34
0

@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);
            }
        }
Red Knight 11
  • 127
  • 1
  • 10