Search This Blog

Monday, July 13, 2015

Ax2012 Useful functions 2

Show viewhistory on form datasources if you have ValidaTimeState Enabled DateTime enabled on the tables of that form. 
create this method in Global class so you can call whereever you want in form button click as below.

void clicked()

    buttonHistoryClick(element, this);

static public void buttonHistoryClick(FormRun _formRun, FormButtonControl _fbc)
    void changeDataSources(ValidTimeStateAutoQuery _from, ValidTimeStateAutoQuery _to, boolean _allowDelete)
        Counter         dataSourceNo;
        FormDataSource  formDataSource;

        for (dataSourceNo=1;_formRun.dataSourceCount()>=dataSourceNo;dataSourceNo++)
            formDataSource = _formRun.dataSource(dataSourceNo) as FormDataSource;
            if (formDataSource.validTimeStateAutoQuery() == _from && new DictTable(formDataSource.table()).isValidTimeStateTable())
                switch (_to)
                    case ValidTimeStateAutoQuery::AsOfDate:
                    case ValidTimeStateAutoQuery::DateRange:
                        formDataSource.query().validTimeStateDateTimeRange(DateTimeUtil::minValue(), DateTimeUtil::maxValue());

    if (_fbc.labelText() == "@SYS110266")
        changeDataSources(ValidTimeStateAutoQuery::AsOfDate, ValidTimeStateAutoQuery::DateRange, false);
        _fbc.text("Stop viewing History");
        changeDataSources(ValidTimeStateAutoQuery::DateRange, ValidTimeStateAutoQuery::AsOfDate, true);

// this method is used to create filenameTimeStamp.

static FileName createFilenameTimeStamp()
    FileName    ret;
    Microsoft.Dynamics.IntegrationFramework.Adapter.FileSystem       fileSystem;

    fileSystem      = AifUtil::getClrObject(#FileSystemProgId);

    ret = fileSystem.GetCurrentTimestamp();

    return ret;

// This method is used to split the string, and returns the conatiner with the position defined in the parameter
public static str rsaStrSplit(str _splitString,str _splitchar,int _pos)
    List strlist=new List(Types::String);
    ListIterator    iterator;
    container       packedList;
    iterator = new ListIterator(strlist);
        packedList += iterator.value();;
    return conPeek(packedList,_pos);


public static str encrypt(str _input, str _salt = '')
    System.Security.Cryptography.SHA512Managed  sha512managed = new System.Security.Cryptography.SHA512Managed();
    System.Text.Encoding                        encoding = System.Text.Encoding::get_UTF8();

    System.Byte[]                               inputBytes;
    System.Byte[]                               resultBytes;

    int                                         i;
    str                                         returnString;

    new InteropPermission(InteropKind::ClrInterop).assert();

    inputBytes = encoding.GetBytes(strLwr(_salt) + _input); // Convert lower case salt + input into byte array

    // The input is hashed 1024 times for attack resiliency
    for (i = 0; i < 1024; i++)
        resultBytes = resultBytes ? resultBytes : inputBytes; // First loop uses input for hashing
        resultBytes = sha512managed.ComputeHash(resultBytes);

    returnString = System.Convert::ToBase64String(resultBytes);


    return returnString;

private static Map fileGetList(FilePath            _filePathArchive)

    Map                 mapFiles;

    InteropPermission   interopPermission = new InteropPermission(InteropKind::ClrInterop);
    Set                 interopPermissionSet = new Set(Types::Class);
    System.Array        arrayFiles;

    int                 i;

    // Granting file permission rights

    mapFiles = new Map(Types::String, Types::String); // Key = return file | Value = archive path

        if (!System.IO.Directory::Exists(_filePathArchive))
             throw  error("Path doesnt exist");

        arrayFiles = System.IO.Directory::GetFiles(_filePathArchive);

        // CLRInterop::getAnyTypeForObject method is used to handle difference in AX and System types (e.g. System.Int32 != int)

        for (i = 0; i < CLRInterop::getAnyTypeForObject(arrayFiles.get_Length()); i++)
       mapFiles.insert(CLRInterop::getAnyTypeForObject(arrayFiles.GetValue(i)), _filePathArchive);

    // Reverting file permission rights

    return mapFiles;

/// <summary>
///  Gets the SenderID from AIF xml .
/// </summary>
/// <param name="messagePartsXml">
/// An <c>AifXml</c> value.
/// </param>
/// <returns>
/// An instance of the <c>str document Namespace</c> class.
/// </returns>
public static str getSenderIDValue(AifXml messagePartsXml)
     XmlTextReader               xmlReader;
    str value,currentElement,pureElement;

    xmlReader = XmlTextReader::newXml(messagePartsXml);
    while (xmlReader.Read())
        switch (xmlReader.nodeType())
             case XmlNodeType::Element:
                  currentElement =;
             case XmlNodeType::Text:
                  pureElement = subStr(currentElement,strFind(currentElement,':',1,256)+1,256);
                    switch (pureElement)
                       case "SenderId":
                            return value;

    return value;

AX2012 Replacing Company element value in AIF using .net dll and QueryService

In AIF we have some data coming from externalSystem, which externalSystem doesnt have anyinformation to which company it should load, as ExternalSystem knows the information about coRegNum as we have to find the right company in AX by using coRegNum.
so I build a .net component where we use the dll in transformation to replace the companyelement in the header to pass the file into right company.
I am using QueryService which I querying the companyInfoTable with the range coRegNum and getting the right Company and replacing in the sourceXML in transfromation in headersection.

sample xml section below.

<ns0:Envelope xmlns:ns0="">
<ns0:LedgerGeneralJournal xmlns:ns0="" xmlns:st="">

Before writing this class add serviceReference QueryService from AX standardservice into your solution that will create app.config as below

<?xml version="1.0" encoding="utf-8" ?>
                <binding name="QueryServiceEndpoint" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    transactionFlow="false" transferMode="Streamed" transactionProtocol="OleTransactions"
                    hostNameComparisonMode="StrongWildcard" listenBacklog="10"
                    maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10"
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <reliableSession ordered="true" inactivityTimeout="00:10:00"
                        enabled="false" />
                    <security mode="Transport">
                        <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
                        <message clientCredentialType="Windows" />
            <endpoint address="net.tcp://KrishhDax:8201/DynamicsAx/Services/QueryService"
                binding="netTcpBinding" bindingConfiguration="QueryServiceEndpoint"
                contract="AXQueryService.IQueryService" name="QueryServiceEndpoint">
                    <servicePrincipalName value="host/" />


Create a tranform class which extends from Itransform.
I am using xml.linq to read the element value in the class, so I referenced System.Xml.Linq;

using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Dynamics.IntegrationFramework.Transform;
using System.Xml;
using System.Xml.Linq;
using KrishhIbanToCompanyTrans.AXQueryService;
using System.ServiceModel;
using System.Data;
using System.Net;

namespace KrishhIbanToCompanyTrans
    public class IBANToCompanyTrans : ITransform
        public void Transform(System.IO.Stream input, System.IO.Stream output, string config)
            XDocument inputXml = XDocument.Load(input);

            string accStr = inputXml.Root.Descendants().Where(e => e.Name.LocalName == "Company").First().Value;
            string[] serviceParams = config.Split(';');

            if (serviceParams.Count() != 1 && serviceParams.Count() != 4)
                throw new ArgumentException("Invalid configuration passed. Expecting single endpoint address or endpoint address with username, password and domain, separated by ;");

            NetTcpBinding binding1 = new NetTcpBinding();
            EndpointAddress epa = new EndpointAddress(serviceParams[0]);

            binding1.Name = "QueryServiceEndpoint";
            binding1.TransactionProtocol = TransactionProtocol.OleTransactions;
            binding1.TransferMode = TransferMode.Streamed;
            binding1.Security.Mode = SecurityMode.Transport;
            binding1.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;
            binding1.Security.Transport.ClientCredentialType =  TcpClientCredentialType.Windows;
            binding1.Security.Transport.ProtectionLevel = System.Net.Security.ProtectionLevel.EncryptAndSign;
            binding1.Security.Message.ClientCredentialType = MessageCredentialType.Windows;
            binding1.ReliableSession.Enabled = false;

            QueryServiceClient serviceClient = new QueryServiceClient(binding1, epa);

            if (serviceParams.Count() == 4)
                serviceClient.ClientCredentials.Windows.ClientCredential.UserName = serviceParams[1];
                serviceClient.ClientCredentials.Windows.ClientCredential.Password = serviceParams[2];
                serviceClient.ClientCredentials.Windows.ClientCredential.Domain = serviceParams[3];

            QueryMetadata query = new QueryMetadata();
            query.DataSources = new QueryDataSourceMetadata[1];
            query.Name = "CompanyInfo";
            QueryDataSourceMetadata queryDS = new QueryDataSourceMetadata();
            queryDS.Name = "CompanyInfo";
            queryDS.Table = "CompanyInfo";
            queryDS.Enabled = true;
            query.DataSources[0] = queryDS;
            queryDS.DynamicFieldList = false;
            queryDS.Fields = new QueryDataFieldMetadata[2];
            QueryDataFieldMetadata fieldId = new QueryDataFieldMetadata();
            fieldId.FieldName = "DataArea";
            fieldId.SelectionField = SelectionField.Database;
            queryDS.Fields[0] = fieldId;
            QueryDataFieldMetadata fieldName = new QueryDataFieldMetadata();
            fieldName.FieldName = "CoRegNum";
            fieldName.SelectionField = SelectionField.Database;
            queryDS.Fields[1] = fieldName;
            queryDS.Ranges = new QueryDataRangeMetadata[] { new QueryDataRangeMetadata() { TableName = "CompanyInfo", FieldName = "CoRegNum", Value = accStr, Enabled = true } };

            Paging paging = new ValueBasedPaging() { RecordLimit = 25 };

            DataSet dataset = serviceClient.ExecuteQuery(query, ref paging);

            if (dataset != null)
                if (dataset.Tables.Count > 2)
                    if (dataset.Tables[3].Rows.Count > 0)
                        DataRow dr = dataset.Tables[3].Rows[0];

                        var element = inputXml.Root.Descendants().Where(e => e.Name.LocalName == "Company").First();
                        if (element != null)
                            element.Value = dr["DataArea"].ToString();


This method is used to test the above code.
        static void Main(string[] args)
            IBANToCompanyTrans transformClass = new IBANToCompanyTrans();

            FileStream input, output;

            // Create the two streams to pass into the assembly. You will need to change these
            // to your file locations.
            input = new FileStream("C:\\Temp\\922\\922.xml", FileMode.Open);
            output = new FileStream("C:\\Temp\\922\\922_c.xml", FileMode.OpenOrCreate);

            string paramString = "net.tcp://hssdas115:8201/DynamicsAx/Services/QueryService";
            // Passes in the customers CSV file and gets back an XML file.
            transformClass.Transform(input, output, paramString);

            // Displays the XML to the console.
            //            StreamReader sreader = new StreamReader(new FileStream("c:\\temp\\testtmpn.xml", FileMode.Open));
            //            Console.Write(sreader.ReadToEnd());
            //            Console.ReadLine();

        } */

After building this component, go to the inboundPort and click transformation button and go to transformations and create the .net dll  transformation and provide the dll and select the class in the dropdown.
in Config file provide the app.config file for this transformation.

Thursday, June 25, 2015

AIF Outbound Read ParentAXBC while processingRecord AX2012


In AIF outbound document service Exporting Invoices information,
In this document we have the customization as one table which contains the printTemplates where it stores the printTemplate information like,address,bankdetails,etc.Using this printTemplate number the external system will define which printing report they have to use.
The Requirement is  The Address containes all the street,country,etc. these information we have to generate from translation tables based on the language that defined in the custinvoiceJournal.

so the datasource lookes like this.
custinvoicejour->custinvoicetrans,custTable,etc, as well printTemplateTable also outerjoins to the custinvoicejour.

I didnt find the way where I can get the parentaxbc object while processing the current record.

I thought to get parentAXBC object always for the outbound for the current AXBC record.

See the Modification that I have build.

1. AXDBase class
             added the class variable as AXInternalBase parentAXBC;

2. AxdBaseRead class
   Open method serializeRecord add the folllowing line of code above        AXbase.ProccesingRecord(common) line in that method

3. AxdBaseGenerateXSD class
   Open this class edit method addDocumentProperties and add one more case for classType as below, so that while serialization class object wont fail.
// added by krishna for to check for class type also. begins
case Types::Class:
if (typename == '')
typename = #xsdStringType;
typeNameSpace = #xsdNameSpace ;

// added by krishna for to check for class type also.

Now framework was updated to get parentAXBC allways while outbound. now you can write logic whatever you want to use it.

Open AXDSalesInvoice class and update the processing record with the business logic for you to handle.
It this method i am verifying the current record in printTemplate then get the parent and get the languageId from that do my logic.

public void processingRecord(Common common)
 PrintTemplate PrintTemplate;
 AxCustInvoiceJour axCustInvoiceJour;
 if(common.TableId == tableNum(PrintTemplate))


If you guys likes this post and useful please like and share it.


Editable Multi select lookup in Grid field AX2012

Scneario: Multiple select Editable lookup  in grid

I created an extension of class from SysLookupMultiselectGrid

class KrisSysLookupMultiSelectGrid extends SysLookupMultiSelectGrid

public void setSelected()
 dictfield dictField;
 Common currentDSRecord;
 FormDataSource formdatasource;
 callingControlId.text(SysOperationHelper::convertMultiSelectedValueString       (selectedId));
 formdatasource = callingControlId.dataSourceObject();
 if(formdatasource && callingControlStr.dataField())
  dictfield = new dictfield(formdatasource.table(),callingControlStr.dataField());
   currentDSRecord = formdatasource.cursor();
   currentDSRecord.( = currentDSRecord.( +     SysOperationHelper::convertMultiSelectedValueString(selectedStr);

public static KrisSysLookupMultiSelectGrid construct(FormControl _ctrlId,
FormControl _ctrlStr)
KrisSysLookupMultiSelectGrid lookupMS;
lookupMS = new KrisSysLookupMultiSelectGrid ();
return lookupMS;


On form declare this class on the form level as below

KrisSysLookupMultiSelectGrid multiSelectGrid;

On form Init method initiliaze this object as below
multiSelectGrid = KrisSysLookupMultiSelectGrid ::construct(GridResults_Value,GridResults_Value);

On grid string edit field lookup method you can use this object as below

Query query = new Query();

QueryBuildDataSource queryBuildDataSource;

queryBuildDataSource = query.addDataSource(tableNum(DimensionAttribute));

you can see in form as below screenshot

Its editable and multi select lookup.

AIF Inheritance Extending AXD classes AX2012


I have multiple ledgerTransaction files coming from different source systems to AX, so each file import must have different business logic,business handlings regarding the dimensions, type of files ex ledger,cust,bank,vend.

I build the whole logic in the standard AXDLEdgerGeneralService class in deserializeEntity method with journalNames I handled, but its becoming more complex and to maintain the functionality and growing business requirements, its getting messing in the code.

I designed the inheritance for AIF documents, For each inbound we can have different axdclass with their own business logic implemented and I defined which axdclass that you want to run on that inbound port. It became easier to maintain the code and standard class is same as Standard.

I thought to share as it may be useful for lot of people.

abstract class AifDocument extends AfStronglyTypedDataContainer
    classId             axdClassId;
    AxdBase             axdInstance;

    AifXml              documentXml;
    boolean             documentXmlExists;
    boolean             deserializeNow;

public classId parmAXDClassId(classId _classId=axdClassId)

    return axdClassId;

Add field ClassId in table AIFInboundPort which extends classID EDT.
Create an Edit method in this table
edit className name(boolean set, Classname value)
     classid classID;
           value = classid2name(this.classid);

Create an inMemmory table AifAxdClassLookup with the field ClassName of EDT Name.
Edit the form aifinboundPort and add a method at element level
Declare a variable at form level as AifAxdClassLookup aifAxdClassLookup;

Add AXDClass string edit control on details header group. define Datamethod Name

Add progress control under details header  group and name it as progress.

Create element level method as below, we will use this method in the lookup of the AXDclass string edit control.

void generateAXDClassesLookupTable()
    AXDBase componentInstance;
    Dictionary dictionary;
    SysDictClass dictClass;
    int i;
    int classCount;
    classId componentInterfaceId,componentInterfaceId1;

    SysTableLookup              sysTableLookup;

    dictionary = new Dictionary();

    classCount = dictionary.classCnt();

    for (i=1; i <= classCount; i++)
        dictClass = new SysDictClass(dictionary.classCnt2Id(i));
        if (dictClass.isImplementing(componentInterfaceId1))
            componentInstance = dictClass.makeObject();
            AifAxdClassLookup.ClassName =;
    componentLookupGenerated = true;

Override the lookup method of AXDClass string edit control and add below code

public void lookup()
   SysTableLookup          tableLookup;
    Query                   query;
    QueryBuildDataSource    queryBuildDataSource;

    if (componentLookupGenerated == false)

    query = new Query();
    queryBuildDataSource = query.addDataSource(tablenum(AifAxdClassLookup));

    tableLookup = SysTableLookup::newParameters(tablenum(AifAxdClassLookup), this);
    tableLookup.addLookupfield(fieldnum(AifAxdClassLookup, ClassName));
    //BP Deviation Documented.


Modify the service class ex: ledgerGeneralService class in my case its ledgerGeneralJournalService
[AifDocumentCreateAttribute, SysEntryPointAttribute(true)]
public AifEntityKeyList create(LedgerGeneralJournal _ledgerGeneralJournal)
    AifInboundPort aifInboundPort;
    ClassId AxdClassId;
    //Assign inheritance extension AXDclass for each port defined on the inboundPort added by krishna.
    if (operationContext != null)

    //assign inheritance extension AXDclass for each port defined on the inboundPort added by krishna.
    return this.createList(_ledgerGeneralJournal);


Now we will create a class which extends AXDclass ex: AXDLedgerGeneralJournal

class AxdLedgerGeneralJournal_GeneralALL extends AxdLedgerGeneralJournal

Override the queryName method and use which query you are using for your inbound AIF
In my example I am using AXDLedgerGeneralJournal

public QueryName getQueryName()
    return querystr(AxdLedgerGeneralJournal);

Now you can override whatever the method you want to overiride, in my case I am overriding deserializeentity.
This method contains all my modification logic.

public void afterDeserializeEntity(AxInternalBase _axbc, tableId _tableId, str _dataSourceName)
    AxdBaseProperty axdBaseProperty = new AxdBaseProperty();
    container       dimensionValue, axdBasePropertyContainer, dimensionValueConverted,bankDimensionContainer;
    recId           dimensionFieldRecId,bankDimensionFieldRecid;
    int             containerElementIndex = 1;
    int             containerLength;
    int             fieldId;
    selectableDataArea company, offsetCompany;
    BankAccountTable localBankAccountTable;
    AccountStatementRules AccountStatementRules;

    JournalNameId localJournalName;
    LogisticsPostalAddressView    locallogisticsPostalAddressView;
    LogisticsLocationParty        logisticslocationParty;
    CustTable                     localCustTable;

    MappingText                localMappingText="";

    containerLength = conLen(fieldList);

    if (containerLength == 0)

    if(_tableId == tableNum(LedgerJournalTrans))
        ledgerJournalName = LedgerJournalName::find(_axbc.parentAxBC().fieldId(fieldNum(ledgerJournalTable, JournalName)));

    if(_tableId == tableNum(LedgerJournalTable))
        ledgerJournalName = LedgerJournalName::find(_axbc.fieldId(fieldNum(ledgerJournalTable, JournalName)));
        ateAccountDefinitionId = ATEAccountDefinitionTable::findRecId(
    if (_tableId == tableNum(LedgerJournalTrans))
        company         = _axbc.fieldId(fieldNum(LedgerJournalTrans, Company));
        offsetCompany   = _axbc.fieldId(fieldNum(LedgerJournalTrans, OffsetCompany));

        company         = AifLookupEntry::findInternal(SystemParameters::find().LookupTableId,company);
        offsetCompany   = AifLookupEntry::findInternal(SystemParameters::find().LookupTableId,offsetCompany);

        if(LedgerJournalName::find(_axbc.parentAxBC().fieldId(fieldNum(ledgerJournalTable, JournalName))).JournalName=="1234")
            company         =curext();
            offsetCompany   =curext();

        if (company)
            _axbc.fieldId(fieldNum(LedgerJournalTrans, Company), company);
            company         =curext();
            _axbc.fieldId(fieldNum(LedgerJournalTrans, Company), company);

        if (offsetCompany)
            _axbc.fieldId(fieldNum(LedgerJournalTrans, OffsetCompany), offsetCompany);
            offsetCompany   =curext();
            _axbc.fieldId(fieldNum(LedgerJournalTrans, OffsetCompany), offsetCompany);
         // Validate the primary and offset companies.
        this.validateCompany(_axbc.currentRecord(), tableNum(LedgerJournalTrans), fieldNum(LedgerJournalTrans, Company), company);
        this.validateCompany(_axbc.currentRecord(), tableNum(LedgerJournalTrans), fieldNum(LedgerJournalTrans, OffsetCompany), offsetCompany);
        axdBasePropertyContainer = conPeek(fieldList, containerElementIndex);
        dimensionValue = conPeek(fieldList, containerElementIndex);

        fieldId = axdBaseProperty.parmImplementingFieldId();

        // If the Table number and Field number match then convert the field by calling axdDimensionUtil
        // and set the corresponding field through its parm method.
        if (_tableId == tableNum(LedgerJournalTable) &&
            fieldId == fieldNum(LedgerJournalTable, OffsetLedgerDimension))
            // MultiTypeDefaultAccount requires an account type to be specified.
            //return AxdDimensionUtil::getMultiTypeDefaultAccountId(_accountTypeEnumId, _accountType, _dimensionValue);
            dimensionFieldRecId = AxdDimensionUtil::getMultiTypeDefaultAccountId(enumName2Id('LedgerJournalACType'),
                                                                                 _axbc.fieldId(fieldNum(LedgerJournalTable, OffsetAccountType)),
            _axbc.fieldId(fieldNum(LedgerJournalTable, OffsetLedgerDimension), dimensionFieldRecId);
        else if (_tableId == tableNum(LedgerJournalTrans))
            if (fieldId == fieldNum(LedgerJournalTrans, LedgerDimension))

                if (ateAccountDefinitionId)
                        dimensionValueConverted = this.ConvertLedgerdimension_PC(
                                _axbc.fieldId(fieldNum(LedgerJournalTrans, ExternalAccountString))
                            , _axbc.fieldId(fieldNum(LedgerJournalTrans, Company))
                            , _axbc.fieldId(fieldNum(LedgerJournalTrans, CurrencyCode))
                            , LedgerJournalName::find(_axbc.parentAxBC().fieldId(fieldNum(ledgerJournalTable, JournalName))).JournalName);
                        if (BankAccountTable::exist(conPeek(dimensionValueConverted,2)))
                            _axbc.fieldId(fieldNum(LedgerJournalTrans, AccountType), LedgerJournalACType::Bank);
                        dimensionFieldRecId = AxdDimensionUtil::getMultiTypeAccountId(enumName2Id('LedgerJournalACType'),
                                                                                        _axbc.fieldId(fieldNum(LedgerJournalTrans, AccountType)),
                else  //Non ATE starts
                    dimensionFieldRecId = AxdDimensionUtil::getMultiTypeAccountId(enumName2Id('LedgerJournalACType'),
                                                                                    _axbc.fieldId(fieldNum(LedgerJournalTrans, AccountType)),
                }// Else Non ATE closed

                _axbc.fieldId(fieldNum(LedgerJournalTrans, LedgerDimension), dimensionFieldRecId);
            }// IF ledgerJournalTrans ledgerDimensionClosed field is closed
            else if (fieldId == fieldNum(LedgerJournalTrans, OffsetLedgerDimension))

                if (ateAccountDefinitionId)
                    dimensionValueConverted = this.ConvertLedgerdimension_PC(
                            _axbc.fieldId(fieldNum(LedgerJournalTrans, OffsetAccountString))
                        , _axbc.fieldId(fieldNum(LedgerJournalTrans, OffsetCompany))
                        , _axbc.fieldId(fieldNum(LedgerJournalTrans, CurrencyCode))
                        ,LedgerJournalName::find(_axbc.parentAxBC().fieldId(fieldNum(ledgerJournalTable, JournalName))).JournalName);
                    dimensionFieldRecId = AxdDimensionUtil::getMultiTypeAccountId(enumName2Id('LedgerJournalACType'),
                                                                                    _axbc.fieldId(fieldNum(LedgerJournalTrans, OffsetAccountType)),
                }// ATE offset closed
                    dimensionFieldRecId = AxdDimensionUtil::getMultiTypeAccountId(enumName2Id('LedgerJournalACType'),
                                                                                    _axbc.fieldId(fieldNum(LedgerJournalTrans, OffsetAccountType)),
                }//ELse non ATE  offset closed

                _axbc.fieldId(fieldNum(LedgerJournalTrans, OffsetLedgerDimension), dimensionFieldRecId);
            }//Else if OffsetLedger dimension closed
            else if (fieldId == fieldNum(LedgerJournalTrans, DefaultDimension))
                dimensionFieldRecId = AxdDimensionUtil::getDimensionAttributeValueSetId(dimensionValue, company);
                _axbc.fieldId(fieldNum(LedgerJournalTrans, DefaultDimension), dimensionFieldRecId);
            }//Else if Default dimension closed
            else if (fieldId == fieldNum(LedgerJournalTrans, OffsetDefaultDimension))
                // OffsetDefaultDimension requires a Legal entity to be specified to support intercompany transactions.
                dimensionFieldRecId = AxdDimensionUtil::getDimensionAttributeValueSetId(dimensionValue, offsetCompany);
                _axbc.fieldId(fieldNum(LedgerJournalTrans, OffsetDefaultDimension), dimensionFieldRecId);
            }//Else if OffsetDefault dimension closed
        }//IF ledgerJournalTrans table check closed
    }//Do while closed
    while (containerElementIndex < containerLength);
    fieldList = conNull();

 If you guys likes this post please share it and like this post.

if you have any queries please contact and message me.