You could have found posts on “How to call Form using code”, but, here, my post relates to calling a Form with filtered records.
Here is the Sample Code snippet………………..
static void runFormWithFilteredRecords()
Args args = new Args(formStr(_Employee));
FormDataSource formDataSource = new FormDataSource();
formRun = ClassFactory.formRunClass(args);
formDataSource = formRun.dataSource();
I have written small piece of code to make you understand easily. So, firstly, I am instantiated Args Class with parameter as FormName, declared FormRun object, then Instantiated FormDataSource Class.
Now, Assigned formRun object to Global Class ClassFactory which has a method named formRunClass with parameter as args. I called init() method which initializes the process, assigned formDataSource with formRun.dataSource() which returns form datasource table as a object.
Form gets called but it needs to be filtered. So, formDataSource which has Datasource Table object will filter the record with specified parameters and fetched the result.