Skip to main content

Notifications

Community site session details

Community site session details

Session Id : jqbMBw7yZbtAoHsMJTj+MS
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 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,651 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,997 Most Valuable Professional

Leaderboard
Loading started