Tuesday, March 26, 2019

Data Management import or export error in D365FO:

Hi All,

In order to fix the below issue in Data Management D65FO:
when i am trying to import or export getting below error 
System.Exception: Exception from HRESULT: 0xC0000033
at Microsoft.Dynamics.AX.Framework.Tools.DMF.ServiceProxy.DmfEntitySharedTypesProxy.DoWork[T](Func`1 work)
at Dynamics.AX.Application.DMFGenerateSSISPackage.`generateFileDataV2(DMFDefinitionGroupExecution _dmfDefinitionGroupExecution, String _defGroupName, DMFFileFormat _fileFormat, DMFDelimiter _rowDelimiter, DMFDelimiter _columnDelimiter, String _codePage, String _locale, NoYes _isFirstRowHeader, NoYes _unicode, String _source, String _textQualifier, DMFXMLStyle _style, String _rootElement, String _filePath, Map _entitySyncVersion, Int32 _previewCount, Boolean @_entitySyncVersion_IsDefaultSet, Boolean @_previewCount_IsDefaultSet) in xppSource://Source/ApplicationFoundation\AxClass_DMFGenerateSSISPackage.xpp:line 1230

Solution: updated  SQL Server Licence in all AOS Machines and SQL Server Machine.  

Tuesday, March 19, 2019

How to enable access into the environment by specifying which IPs in D365:

Enable access into the environment by specifying which IPs can access the environment for a given service type.

1. Go to LCS for your project.
2. Go to Maintain - Enable access as below.

3. enter the public IP to connect to the RDP.



Saturday, March 16, 2019

How to get the User Date Sequence in Axapta2012 / D365OF:

Normally, we specify 123 or 321 sequence in str2Date(). But, in order to get the sequence randomly the below code is useful:

static int userDateSequence()
    {
        int     ds1, ds2, ds3;
        date    d = str2Date('2015/12/18', 321);
        str     s = strFmt('%1', d);


        void datepart(str strDate, str dval, int part)
        {
            if (strEndsWith(strDate, dval))
            ds3 = part;
            else if (strStartsWith(strDate, dval))
            ds1 = part;
            else
            ds2 = part;
        }

        datepart(s, '18', 1);
        datepart(s, '12', 2);
        datepart(s, '2015', 3);

        return ds1 * 100 + ds2 * 10 + ds3;
    }

How to fetch HSNCode in Ax2012 Indian GST Microsoft Hotfix:

In order to get the value of HSN code in Ax2012, we should know where exactly the HSN code is attached?
1. Normally, HSN code is attached to each item on the Item master under Foreign tab.
2. At the sales or purchase order line under Tax information-GST Tab, the HSN code can be manually selected by user.

The list of tables which has reference to other tables below:

TaxDocument has a reference to SalesTable.
TaxDocumentExtension_IN has a reference to TaxDocument.
TaxDocumentRow has  reference to SalesLine.
TaxDocumentRowTransaction has a reference to CustInvoiceTrans, CustInvoiceJour.
SalesLine_IN has a reference to SalesLine.

TaxDocumentRowTransaction_IN has the HSN code, which will have reference to TaxDocumentExtension_IN and TaxDocumentRowTransaction.

The below code is used to fetch the HSN Code:
//Normally, HSNCode if fetched from the InventTable but otherwise, it will also be fetched from salesline level.:

TaxDocumentRowTransaction       taxDocumentRowTransaction;
TaxDocumentRowTransaction_IN    taxDocumentRowTransaction_IN;
SalesTable                  salesTable;
SalesLine_IN                salesLine_IN;

salesLine_IN    = custInvoiceTrans.salesLine().salesLine_IN();
//TmpSalesPurchRegister is my buffer table.

//TmpSalesPurchRegister.Intracode     = HSNCodeTable_IN::find(InventTable::find(TmpSalesPurchRegister.ItemId).HSNCodeTable_IN).Code;
            Select RecId, TransactionJourLineRecId from taxDocumentRowTransaction
                where taxDocumentRowTransaction.TransactionJourLineRecId == custInvoiceTrans.RecId
            join HSNCode, TaxDocumentRowTransactionRecId from taxDocumentRowTransaction_IN
                where taxDocumentRowTransaction_IN.TaxDocumentRowTransactionRecId == taxDocumentRowTransaction.RecId;
            if(taxDocumentRowTransaction_IN)

            /*select * from taxTrans where taxTrans.SourceRecId == custInvoiceTrans.RecId
            join taxTrans_IN where taxTrans_IN.RefRecId == taxTrans.RecId;
            if(taxTrans_IN)*/
            {

                TmpSalesPurchRegister.Intracode = taxDocumentRowTransaction_IN.HSNCode;
                //TmpSalesPurchRegister.Intracode = HSNCodeTable_IN::find(taxTrans_IN.HSNCodeTable).Code;
            }
            else
            {
                TmpSalesPurchRegister.Intracode = HSNCodeTable_IN::find(salesLine_IN.HSNCodeTable).Code;
            }