Settlements (Technical Utility methods)

Piece of code that checks if the invoice is already marked with some payment or not

 protected boolean checkIfAlreadyMark(CustVendTransOpen _custVendTransOpen)  
   specTransManager specTransManager = specTransManager::construct(_custVendTransOpen);  
   return specTransManager.existForOtherSpec(, _custVendTransOpen.TableId, _custVendTransOpen.RecId);  

Piece of code that settles the invoice with the payment

 protected void markSettlement(CustVendTransOpen _custVendTransOpen)  
   CustVendOpenTransManager manager = CustVendOpenTransManager::construct(ledgerJournalTrans);  
   manager.updateTransMarked(_custVendTransOpen, true);  

Opening Balance import through DIEF (Data Import Export Framework

Hi Guys and Happy Independence day to all my country mates and Happy Birth day to PAKISTAN


Okie, This exercise is about importing Opening Balance through DIEF (Data Import Export Framework, I am using Dynamics AX R3 CU8.

1 Create “Processing Group” – “Opening Balance”


2 Click Entities and select Entity as “Opening Balance”
3 Select Source data format as “Excel”
We need to create source data format record as this6

4 Click Generate Source file for generating the template, We can select all the needed fields here.


5 Click Modify Source Mapping,
Ops here I got the error

Error Message: Assembly containing type Microsoft.Dynamics.AX.Framework.Tools.DMF.ServiceProxy.DmfEntityProxy is not referenced.

Object ‘CLRObject’ could not be created

There can be multiple reason for this issue but I solved it through these steps.

Solution: Above mention error come because you are trying to set parameter without installing its component (Service, Server and Client). Just install those component from setup file and restart the AOS service. Now this error should not bother you this time. :)

After restarting the AX, I have open the parameter form, specified the correct shared working directory and validate the settings.



5 Click again on “Modify Source Mapping,”

As we need Journal Number to be Auto generated, I modify it by marking JournalNumber auto generated, and I also added the JournalName field in Query Criteria such that all the lines (with the same JournalName value) will be assigned the same JournalNumber


After this select the excel file with data in the ENTITIES form and click preview to viewing the data.


In the last for moving the data to staging table, click “Get staging data” then for copying the data to target, click on Copy data to target.


and here we have the end result



Get default financial dimension values through X++ code

This topic is not new and we have lots of blogs available on it. Yasir Co-blogger also explained this quite well in his blog. The purpose to share this again here that I have did some minor modifications in his job to get both attributes (Value and Name) for Default dimension. Complete code is here.

static void GetDefaultDimensionAttributeName(Args _args)
    DimensionAttributeValueSetStorage    dimStorage;
    HcmPositionDefaultDimension          HcmPositionDefaultDimension;
    DimensionAttribute  DimensionAttribute;
    Counter                                               i;
    DimensionAttribute          dimAttr;
    DimensionAttributeValue     dimAttrValue;
    Common                      common;
    DictTable                   dictTable;
    str                         Name;
    str                         value;

    // get the dimension value from position    
    HcmPositionDefaultDimension = HcmPositionDefaultDimension::findByPositionLegalEntity(HcmPosition::findByPosition("000001").RecId,CompanyInfo::find().RecId);

    // make the dimension storage object    
    dimStorage = DimensionAttributeValueSetStorage::find(HcmPositionDefaultDimension.DefaultDimension);

    for (i=1 ; i<= dimStorage.elements() ; i++)
        // get attribute select here.
        select firstonly dimAttrValue
        where dimAttrValue.RecId == dimStorage.getValueByIndex(i)
        join dimAttr
            where dimAttr.RecId == dimAttrValue.DimensionAttribute;

        if (dimAttr && dimAttrValue)
            dictTable = new DictTable(dimAttr.BackingEntityType);
            common = dictTable.makeRecord();

            if (common.TableId)
                select common where common.(dimAttr.KeyAttribute) == dimAttrValue.EntityInstance;
                name = common.(dimAttr.NameAttribute);
                value = common.(dimAttr.ValueAttribute);
        info(dimAttr.Name +"----" +value + "----"+name);

output image

we can check the other examples on same topic from Yasir’s Blog – Microsoft Dynamics AX

How to get meaningful AIF messages on Web service consumer?

Sometime on your consumer code you don’t know the cause of error and you have to dig into it by looking at exception form with in AX. Although there is a way to get all the meaningful messages at your consumer end also.

Obviously “Include exception in fault” checkbox needs to be enabled on your inbound port.

After that small piece of code (Catch) block will help you to get the meaningful messages.

catch (System.ServiceModel.FaultException<AxIntegrationServiceRefCust.AifFault> aiffaultException)
                AxIntegrationServiceRefCust.InfologMessage[] list = aiffaultException.Detail.InfologMessageList;

                foreach(AxIntegrationServiceRefCust.InfologMessage message in list)

                return 0;


Get every new post delivered to your Inbox.

Join 410 other followers

%d bloggers like this: