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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Apps
Unanswered

Model Driven App

(0) ShareShare
ReportReport
Posted on 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:
I have the same question (0)

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 1,041

#2
11manish Profile Picture

11manish 676

#3
Valantis Profile Picture

Valantis 655

Last 30 days Overall leaderboard