Skip to main content

Notifications

Community site session details

Community site session details

Session Id : O98ji7IsKDlvN7liZ+nDU8
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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Building Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 177 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 97

#3
stampcoin Profile Picture

stampcoin 80

Overall leaderboard
Loading started