web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : S3IwnQs/40D1n0g+1S2g9b
Power Apps - Building Power Apps
Unanswered

Model Driven App

Like (0) ShareShare
ReportReport
Posted on 30 Apr 2024 20:08:17 by 11

function openModalFormOnLoad(executionContext) {
var formContext = executionContext.getFormContext();
var entityName = "gan_casedata";
var formType = 2; // Use the quick create form

// Check if the form is in create mode (new record)
if (formContext.ui.getFormType() === 1) {
var navigateOptions = {
pageType: "entityrecord",
entityName: entityName,
formType: formType
};

var modalOptions = {
target: 2,
position: 1,
width: {
value: 50,
unit: "%"
}
};

Xrm.Navigation.navigateTo(navigateOptions, modalOptions).then(
function (success) {
console.log("Modal form opened successfully.");
// Optionally, you can refresh the current form after closing the modal
// formContext.data.refresh();
},
function (error) {
console.error("Error opening modal form:", error);
}
);
}
}

I'm using the above code to open the modal form for record creation instead of redirecting to the form. The modal form is opening but in a loop it is continuously opening. I added the web resource on the form OnLoad Event. Where did I made a mistake?

Categories:

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2