Hi all,
I want to add filters for the table DimensionAttributeValueCombination which is added in the init method in the form LedgerTransAccount in Dynamics 365 (V7), I'm using a post_init event handler:
[PostHandlerFor(formStr(LedgerTransAccount), formMethodStr(LedgerTransAccount, init))] public static void LedgerTransAccount_Post_init(XppPrePostArgs args) { FormRun sender = args.getThis(); FormDataSource ds = sender.dataSource("GeneralJournalAccountEntry"); Query query = ds.query(); QueryFilter queryFilter; queryFilter = query.addQueryFilter(query.dataSourceTable(tableNum(DimensionAttributeValueCombination)), "SegmentValue");
It works fine, but when I go to the form, populate the filter field and click "Apply", the filter is applied to the grid on the right, but it disappears from the filter field, so it works, but the value is gone. If I try to do the same with a datasource added in the form design, it works correctly, but not with this one added in the background; is there any way to accomplish this without losing the values each time I click "Apply"?
Thank you!