Xameer
Xameer

Reputation: 31237

Unable to open a quick create form

In our Dynamics 365 instance, we're trying to open a quick create form for an entity called SourceAssessment using the code example here

var thisEntity = {
    entityType: "SourceAssessment",
    id: Xrm.Page.data.entity.getId()
};
var callback = function (obj) {
    console.log("Created new " + obj.savedEntityReference.entityType + " named '" + 

obj.savedEntityReference.name + "' with id:" + obj.savedEntityReference.id);
}
var setName = { name: "Child account of " + Xrm.Page.getAttribute("name").getValue() 

};
Xrm.Utility.openQuickCreate("SourceAssessment", thisEntity, setName).then(callback, function 

(error) {
    console.log(error.message);
});

The entityLogicalName isn't valid. This value can't be null or empty, and it must represent an entity in the organization.

Upvotes: 1

Views: 1196

Answers (1)

mktange
mktange

Reputation: 417

When using the developer console to execute code, you have to first switch to the correct frame, in order to access the Xrm.Page object of the form.

In Chrome you can switch frames here:

enter image description here

The frame you want to be in is usually called customScriptsFrame, and other times it is one of the numbered contentIFrames.

Upvotes: 2

Related Questions