Search code examples
powerappspowerapps-modeldriven

Ribbon button to open specific form


I'm trying to add a button and have it open a "create new" form for my entity using a specific form. I've added the button using the ribbon workbench and I get successfully trigger JavaScript however I'm having trouble getting the right form to display - I always get the default one.

My code is quite simple:

var entityFormOptions = { 
    entityName: 'myEntityName',
    formId: '5c94b6c5-947a-eb11-a812-000d3ab7a3f3'
};

Xrm.Navigation.openForm(entityFormOptions);

As per https://learn.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/xrm-navigation/openform but the formId field doesn't seem to be having any effect. I have set the security roles so that everyone can access.


Solution

  • Turned out it was because my new form was not included in my model-driven app. I needed to select the form for the entity in the entity-view.