How to Open a Filtered Form Using a Menu Item related to a row in D365FO
I Will show you here how to Open a Filtered Form Using a Menu Item related to a row.
for example in Released Products i added a menu item to show Related PRQs to an item like this
public void init()
{
InventTable selectedRecord;
QueryBuildDataSource qbds;
QueryBuildRange qbr;
super();
// Check if arguments are passed and if it's the correct type
if (this.args() && this.args().record() && this.args().record() is InventTable)
{
// Get the selected record
selectedRecord = this.args().record() as InventTable;
// Get the QueryBuildDataSource for the second form's data source
qbds = Oula_ItemRelatedPrq_ds.query().dataSourceTable(tableNum(Oula_ItemRelatedPrq));
// Add a range based on the locationId field
qbr = qbds.addRange(fieldNum(Oula_ItemRelatedPrq, ItemId));
qbr.value(queryValue(selectedRecord.ItemId));
// Execute the query to apply the filter
Oula_ItemRelatedPrq_ds.executeQuery();
}
}
Comments
Post a Comment