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 Platform Community / Forums / Power Apps / Opening Quick Create F...
Power Apps
Suggested Answer

Opening Quick Create Form dynamically

(0) ShareShare
ReportReport
Posted on by 56
Greetings,

I have created two quick create forms for my 'PhoneCall' activity table,

I have added a custom ribbon button on the main form of my Case(incident) entity and want to open a particular Quick create form based on a Security role and if not then I need to open a different Quick Create form in all the other cases.

I had added a similar button to the consumer entity and was able to open the 2 Quick Create forms dynamically based on security roles till yesterday , but now only the default quick create form opens even after passing the JS code condition.

kindly help me to open different Quick Create forms based on security roles as it is necessary for my business requirement.

below is the code snippet that I had been currently and which was working as of yesterday but no longer works now.
 
const userSettings = Xrm.Utility.getGlobalContext().userSettings;
    let roles = userSettings.roles._collection;
    // Security Role : ABC
    let flag = false;
    for (let element in roles) {
        if (roles[element].name == "ABC") {
            flag = true;
            break;
        };
    }

    //var currentFormID = Xrm.Page.ui.zformSelector.getCurrentItem().getId();
    let callMaskingQuickCreateFormId = "GuidA";
    let defaultQuickCreateFormId = "GuidB";

    if (flag) entityFormOptions["formId"] = callMaskingQuickCreateFormId;
    else entityFormOptions["formId"] = defaultQuickCreateFormId;

    Xrm.Navigation.openForm(entityFormOptions, formParameters).then(
        function (success) {
            console.log("new form to create phone call", success);
        },
        function (error) {
            console.log(error);
        }
    );
 
I have the same question (0)
  • Suggested answer
    whitebeard Profile Picture
    135 on at

    If your JavaScript logic is correct but the form still opens to the wrong one, you can check if the specific Quick Create form is missing from your App or not.

    • Go to the App Designer for your specific Model-Driven App.
    • Find the Phone Call table.
    • Under Forms, ensure BOTH Quick Create forms ("GuidA" and "GuidB") are checked/included.
    • Note: If a form is not included in the App, the system will ignore the ID and load the default form available to the App.

    One more thing ensure you initialize entityFormOptions correctly with useQuickCreateForm: true.

    // Setup Options
    var entityFormOptions = {};
    entityFormOptions["entityName"] = "phonecall";
    entityFormOptions["useQuickCreateForm"] = true;
     
    // Set the Form ID based on the flag
    if (hasRole) {
         entityFormOptions["formId"] = callMaskingQuickCreateFormId;
    } else {
            entityFormOptions["formId"] = defaultQuickCreateFormId;
    }
     
     
    Hope this helps!

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 March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 536

#2
WarrenBelz Profile Picture

WarrenBelz 426 Most Valuable Professional

#3
Haque Profile Picture

Haque 305

Last 30 days Overall leaderboard