Update Sub-form (Sub-Page) from Main Page to apply Filters.
Problem Statement:
I have a requirement where I want to update the Subform(Part page) from the Main page, this Subpage(Subform) is linked to the Main page by SubpageLink Property. The Subpage is a List page and I want to filter this list by a field from Main Page.
Pre-requisites:
- VS Code
- AL Language Extension
- Microsoft Dynamics NAV / Business Central
As you can see in the below window a function is created Vendorfilter() on Subpage with the "vendor" parameter, in this function filter is added for the vendor on the part page and then CurrPage.Update() is used. This function will update the Subpage with the vendor.
Now, call this function on "OnValidate" trigger of the Main page field, here we have "Vendor" field on Main Page.
The calling of Function is as follows: CurrPage.<SubpageName>.Page.<FunctionName>(Rec.<FieldName>);
In this example we have CurrPage.POLines.page.Vendorfilter(Rec.Vendor);
Conclusion: Thus we can achieve updating a Subform from the Main Page.
Hope this helps!
Comments
Post a Comment