In this example we want to create a Form using the List Page template and allow multi select to trigger a process on multiple records.
Create a table
Create a query
in this example we keep things simple and just set the Fields property as dynamic to include all fields
Create a class that extends ListPageInteraction
class FCH_ListPageWithMultiselectClass extends ListPageInteraction
{
}
the class in its basic can be as simple as that.
I suggest you always create a new class that extends ListPageInteraction so that you can eventually add your logic.
to see some examples you can look at this form:
\Forms\CustTableListPage which extends: \Classes\CustTableListPageInteraction
also here: http://sujanadynamics.blogspot.com/2013/10/list-page-interaction-class.html
Create the list page form
- In the AOT, right-click the Forms node, click New Form from template, and then click ListPage
- Click the InteractionClass property, expand the drop down list, and then click ListPageWithMultiselectClass (your class that extends ListPageInteraction).
- Specify the query to use with the list page, click the Data Sourcesnode for the form. then set its value to the query you created above
- In the Design node, right-click the grid, and then click Properties. In the properties window, click the DataSource property and set your datasource.
- Drag the fields from the datasource to the Grid.
see more on: https://docs.microsoft.com/en-us/dynamicsax-2012/developer/walkthrough-creating-a-list-page-and-adding-an-action-pane
Create a class to process records
class FCH_ListPageWithMultiselectProcess
{
Args args;
}
public Args parmArgs(Args _args = args)
{
args = _args;
return args;
}
public static void main(Args _args)
{
FCH_ListPageWithMultiselectProcess cl = new FCH_ListPageWithMultiselectProcess();
cl.parmArgs(_args);
cl.process();
}
private void process()
{
MultiSelectionHelper selection = MultiSelectionHelper::createFromCaller(args.caller());
FCH_table1 myTable = selection.getFirst();
while (myTable)
{
//here the processing logic
info(myTable.Firstname);
myTable = selection.getNext();
}
}
Create a Menu Item
Add a new Process Button on the form
In the Action Pane node, expand the action pane tab labelled HomeTab and add a new Button Group. Add to it a menuItemButton
Create a details Form
- In the AOT, right-click Forms, click New Form from template, and then click DetailsFormMaster
- Expand Designs and then click Design. In the Properties window click Caption, and then specify the label you want to appear in the title of the form.
- Find the table you want to add as a form data source. Drag the table to the Data Sources node of the form.
- To set it as primary datasource on Designs click the DataSource property and then select the table you want to use as the primary data source for the form.
- In the property sheet, click the TitleDataSource property and then select the table that contains the field values that you want to appear in the title bar of the form.
- Add Fields (Note, All details forms have two view modes Details view and Grid view: use buttons in the status bar or action pane to switch between the details view and the grid view)
- Add fields to the editable grid
- expand TabPageGrid, expand GridGroup, and then click HeaderGrid.
- click the DataSource property and then select the table
- from the datasource drag that field onto the grid (drag only the fields you typically use the editable grid to quickly find and update a record.)
- Add details fields on the header
- Expand Design, expand Tab, expand TabPageDetails, and then expand HeaderDetailsTab. You should see the HeaderGeneral tab page. Drag from the datasource the fields you want to be able to edit.
- To organize and label groups of fields, you can add one or more Group controls.
- Set the header
you will get something like this:
No comments:
Post a Comment