My 2p about ERP Solutions, Information Worker Solutions and other software products (mainly Microsoft Dynamics AX and Microsoft SharePoint).

02 November 2010

Adding a custom filter to a form

Business requirement: Adding a custom filter to a form

In some cases it is required to ease the filtering on a form. In some cases end users don’t have enough Dynamics AX knowledge to use the Advanced Filter Sort functionality to create a query on the form to achive their filtering requirements.

Solution: Add a checkbox custom filter

The solution is elaborated by means of an example. Suppose you want to provide the end user with an easy filtering on the customer form to show only customers with active Projects (Projects not in the Project Stage Completed).

To achive this, you can follow these steps:

  1. Duplicate the CustTable form and add a checkbox control ctrlCustActProjs to it for the filtering purposes. Set the AutoDeclaration property of the checkbox to Yes.
  2. Add the ProjTable data source to the form and link it to the CustTable data source.
  3. Override the executeQuery method of the CustTable data source as follows:
    public void executeQuery()
    QueryBuildDataSource qbdsProjTable =
    QueryBuildRange qbrProjStatus;

    if (ctrlCustActProjs.value() == NoYes::Yes)
    qbrProjStatus =
    fieldnum(ProjTable, Status));

By toggling the checkbox only customers with active Projects will be shown or not.

Enabling the qbdsProjTable QueryBuildDataSource based on the checkbox links or removes the ProjTable to the CustTable in the form query.

The search for only active Projects is achieved by adding or finding the qbrProjStatus QueryBuildRange. Use the Global::queryNotValue to look up values different from a base Enum value.

Continue reading......

by Patrik Luca 0 comments

Creation of Intercompany Purchase order for a project item requirement

Business requirement: creation of Intercompany Purchase order for a project item requirement

Upon creating an Intercompany Purchase Order based on a project item requirement, the Purchase Order is of type Journal and is uneditable. Hence the Intercompany Sales Order isn’t created neither in the vendor company account and it can’t be created neither as the Intercompany Purchase Order is uneditable.

This behaviour can be easily simulated on the demo data:

  1. Create an item requirement on a project.
  2. Click Functions > Create purchase order.
  3. Select the Include check box in the line for the project item requirement and verify that vendor 9100 is selected in the Vendor field.

Solution: Adapt class SalesTableType

A small X++ code fix can solve this problem in class SalesTableType, method syncPurchTable.

if (_salesTable.fieldChanged(fieldnum(SalesTable, SalesType))) 

        case SalesType::Subscription    :  

        case SalesType::Sales           :  

        case SalesType::ReturnItem      :  

        case SalesType::Blanket         :  

        // BEGIN: intercompany chain for item requirements
        case SalesType::ItemReq         :  
        // END: intercompany chain for item requirements

        default :


Upon creating an Intercompany Purchase Order, it won’t be of type Journal anymore and the Intercompany Sales Order in the vendor company account will be created automatically too.

Continue reading......

by Patrik Luca 1 comments

Patrik Luca, Ieper, BELGIUM
Feel free to use or spread all of the content on my blog. In return, linking back to my blog would be greatly appreciated. All my posts and articles are provided "AS IS" with no warranties.

Subscribe feeds via e-mail
Subscribe in your preferred RSS reader

Subscribe feeds rss Most Read Entries


Recommended Books

Subscribe feeds rss Recent Comments

This Blog is part of the U Comment I Follow movement in blogosphere. Means the comment field of this blog is made DOFOLLOW. Spam wont be tolerated.

Blog Archive

My Blog List