Friday, 27 March 2020
Wednesday, 25 March 2020
Open in Microsoft office -> Open in Excel customizations in d365:
Open in Microsoft office -> Open in
Excel customizations in d365:
Best example :
Inventory management > Journal entries
> Item > Movement form > Lines > Open in excel > Inventory
movement journal header and lines
Here in this form main data source is InventJournalTable
and join data source is InventJournalTrans
If your creating entity with InventJournalTable
then its name come automatically in open in excel lookup
But if your creating entity other than root
datasource like inventjournal trans
table then for showing lookup in that form we need to do some changes
1.
Form will extended with OfficeIGeneratedWorkbookCustomExporter
Ex : public final class InventJournalMovement extends FormRun
implements OfficeIGeneratedWorkbookCustomExporter
2.
Here in class declaration we
need to declase one variable as
const str
CustomExportLinesToExcelOptionId = 'LinesCustom';
3.
Need to add new method in that form methods(This is for shwing our entity
name in open in excel lookup)
Ex:
public void
customizeMenuOptions(OfficeMenuOptions _menuOptions)
{
TableName
entityName = tableStr(InventInventoryMovementJournalEntryEntity);
List exportOptions
= _menuOptions.customMenuItems();
var exportOption = OfficeGeneratedExportMenuItem::construct(entityName,
CustomExportLinesToExcelOptionId);
exportOption.setDisplayNameWithDataEntity();
exportOptions.addEnd(exportOption);
}
4.
Exporting and importing need to
add one more form method
Ex :
public ExportToExcelDataEntityContext getDataEntityContext(OfficeGeneratedExportMenuItem _menuItem)
{
ExportToExcelDataEntityContext context = null;
if
(_menuItem.id() == CustomExportLinesToExcelOptionId)
{
TableName
entityName = tableStr(InventInventoryMovementJournalEntryEntity);
IdentifierName fieldGroupName = tableFieldGroupStr(InventInventoryMovementJournalEntryEntity, AutoReport);
context = ExportToExcelDataEntityContext::construct(entityName, fieldGroupName);
ExportToExcelDataEntityInfo entity = context.findEntityByName(entityName);
if (entity)
{
ExportToExcelFilterTreeBuilder filterBuilder = new ExportToExcelFilterTreeBuilder(entityName);
var filter =
filterBuilder.and(
filterBuilder.companyFilter(),
filterBuilder.areEqual(fieldStr(InventInventoryMovementJournalEntryEntity, JournalNumber), InventJournalTable.JournalId));
entity.filter(filter);
}
}
return context;
}
5.
If publish button is not
enabled check the entiry auto lookup field group fields data
Auto lookup filed group
fileds are same as key fields (Index)
Subscribe to:
Posts (Atom)