In my model-driven app, I have a QuickView Form for a table that has two subgrids on it for related tables. For those subgrids, I don't want the "New" ribbon option to be available. But for those same related tables, I DO want the New option available when those subgrids are on a Main form. I can use Ribbon Workbench to hide the New option for all subgrids. But, is there a way to only hide it when on a QuickView form? I could use a different View for the subgrid on the QuickView form, but I don't see a way to specify ribbon options for specific Views.
Hi, for your scenario,
I believe you will be using quick view form on some other table. So, you can add an enable rule (Custom rule) to the "New" button of the subgrid with a parameter as Primary Control and use below code to get the entity information of the parent entity.
var showButton = true;
var formContext = primaryControl;
if (formContext.parentFormContext !== null && formContext.parentFormContext !== undefined) {
var parentEntityName = formContext.parentFormContext.data.entity.getEntityName();
if (parentEntityName == {parent entity name}) {
showButton = false;
}
}
return showButton;
With the above code, if I am using the quick view form of table "ABC" on table "DEF", "formContext" would be context of table "ABC" and "formContext.parentFormContext" would be the context of table "DEF".
So, on table "DEF", my quick view form won't show the "New" subgrid button, but on the main form it will show.
WarrenBelz
109
Most Valuable Professional
Michael E. Gernaey
82
Super User 2025 Season 1
MS.Ragavendar
72