Tuesday, 19 January 2016

Add Sales Category/Procurement Category field on customized form in AX 2012

Hi guys,

After very long time today i'm writing a new post [AX 2012] 

I had a requirement to customized Sales Category/Procurement category on a new form it is not direct field to add on form. It was little bit tricky. 

I am showing the steps to do this.

Steps 1.
You need to add a int64 field on table and use edt as "SalesCategory".



Now go to the Properties of the SalesCategory field and set edt as salesCatefory. 



Step 2. Go to the form refresh and restore it to reflect the newly created field then expand datasource  and  go to the salesCategory field and add bellow highlighted methods in the snaps.




Paste these methods  into the datasource > field > method.

resolveRefrence

public Common resolveReference(FormReferenceControl _formReferenceControl)
{
    return EcoResCategory::resolveCategoryHierarchyRole(
        _formReferenceControl,
        EcoResCategoryNamedHierarchyRole::Sales);
}

lookupReference method 

public Common lookupReference(FormReferenceControl _formReferenceControl)
{
    return EcoResCategory::lookupCategoryHierarchyRole(
        _formReferenceControl,
        EcoResCategoryNamedHierarchyRole::Sales);
}


Steps 3. Add RefrenceGroup field into the Grid as bellow shown in the snaps. 



Step 4.
Reference field properties set dataSource and Reference field as "salescategory". 
Save  and compile objects.




Step 5. Now you are able to see the sales Category filed on Customized form.



Hope it will help.

Happy DAXing :-)













2 comments:

  1. Thank you for sharing your knowledge! great tutorial!

    ReplyDelete
  2. Wonderful! Thank you so much for sharing this tutorial with clear explanation how to add Sales Category/Procurement Category field on customized form in Microsoft Dynamics AX system.

    ReplyDelete

Import General journal from excel in D365 F&O

 Hi Guys, Import General journal from excel in D365 F&O Code:  using System.IO; using OfficeOpenXml; using OfficeOpenXml.ExcelPackage; u...