Wednesday, 24 April 2024

X++ Development server C (OSDisk) drive manual maintenance/Cleanup

 My OS Disk was almost full (700 MB remaining) and to clean the drive, i have tried disk/system file cleanup but hardly i got any space

After doing some system search i was able to find a manual way to deal with the issue and luckily it worked just perfectly.

Run the CMD in admin mode and key in below command to delete all temp files

C:\windows\system32>    del /q/f/s %temp%\*


System have found all the temp file and just deleted them automatically 



Now i got 20 gb on OS drive

Happy daxing

Wednesday, 15 September 2021

The source document lines cannot be finalized until the status is Confirmed. The state of the source document or source document line could not be updated.

On PO confirmation, we are getting below error:

The source document lines cannot be finalized until the status is Confirmed.

The state of the source document or source document line could not be updated.

Purchase order  is created from approved PR and is in Approved status. When user is trying to confirm this order, we are getting above error. 

To fix the issue on UAT or SandBox system please run below query on SQL. Also below query impact 'VENDINVOICEJOUR', 'CUSTINVOICEJOUR' and  'PURCHREQTABLE' 

  --Find query

      SELECT *

      FROM SOURCEDOCUMENTHEADER SDH

      JOIN SQLDICTIONARY SD ON SD.TABLEID = SDH.SOURCERELATIONTYPE AND SD.FIELDID = 0 AND SD.SQLNAME IN('VENDINVOICEJOUR', 'CUSTINVOICEJOUR', 'PURCHREQTABLE')

      JOIN ACCOUNTINGEVENT AE ON AE.SOURCEDOCUMENTHEADER = SDH.RECID AND AE.STATE = 3

      WHERE SDH.ACCOUNTINGSTATUS = 1 AND NOT EXISTS

      (SELECT TOP 1 SOURCEDOCUMENTHEADER FROM ACCOUNTINGEVENT WHERE ACCOUNTINGEVENT.SOURCEDOCUMENTHEADER = SDH.RECID AND ACCOUNTINGEVENT.STATE = 0)


      Mitigation Steps:


      Please execute below statements:


      --Update Accounting Distribution table

      DELETE ACCOUNTINGDISTRIBUTION WHERE SOURCEDOCUMENTHEADER IN(

      SELECT SDH.RECID FROM SOURCEDOCUMENTHEADER SDH

      JOIN SQLDICTIONARY SD ON SD.TABLEID = SDH.SOURCERELATIONTYPE AND SD.FIELDID = 0 AND SD.SQLNAME IN('VENDINVOICEJOUR', 'CUSTINVOICEJOUR', 'PURCHREQTABLE')

      JOIN ACCOUNTINGEVENT AE ON AE.SOURCEDOCUMENTHEADER = SDH.RECID AND AE.STATE = 3

      WHERE SDH.ACCOUNTINGSTATUS = 1 AND NOT EXISTS

      (SELECT TOP 1 SOURCEDOCUMENTHEADER FROM ACCOUNTINGEVENT WHERE ACCOUNTINGEVENT.SOURCEDOCUMENTHEADER = SDH.RECID AND ACCOUNTINGEVENT.STATE = 0)

      GROUP BY SDH.RECID, SDH.ACCOUNTINGSTATUS, SDH.SOURCERELATIONTYPE, SDH.TYPEENUMNAME, SDH.TYPEENUMVALUE, SD.SQLNAME, AE.ACCOUNTINGDATE, AE.STATE, AE.RECID)

      AND ACCOUNTINGEVENT = 0


      --Update SourceDocumentLine table

      UPDATE SOURCEDOCUMENTLINE

      SET ACCOUNTINGSTATUS = 4

      WHERE SOURCEDOCUMENTHEADER IN(

      SELECT SDH.RECID FROM SOURCEDOCUMENTHEADER SDH

      JOIN SQLDICTIONARY SD ON SD.TABLEID = SDH.SOURCERELATIONTYPE AND SD.FIELDID = 0 AND SD.SQLNAME IN('VENDINVOICEJOUR', 'CUSTINVOICEJOUR', 'PURCHREQTABLE')

      JOIN ACCOUNTINGEVENT AE ON AE.SOURCEDOCUMENTHEADER = SDH.RECID AND AE.STATE = 3

      WHERE SDH.ACCOUNTINGSTATUS = 1 AND NOT EXISTS

      (SELECT TOP 1 SOURCEDOCUMENTHEADER FROM ACCOUNTINGEVENT WHERE ACCOUNTINGEVENT.SOURCEDOCUMENTHEADER = SDH.RECID AND ACCOUNTINGEVENT.STATE = 0)

      GROUP BY SDH.RECID, SDH.ACCOUNTINGSTATUS, SDH.SOURCERELATIONTYPE, SDH.TYPEENUMNAME, SDH.TYPEENUMVALUE, SD.SQLNAME, AE.ACCOUNTINGDATE, AE.STATE, AE.RECID)

      AND ACCOUNTINGSTATUS = 3


      --Delete the SourceDocumentLine records in accounting status of 1

      DELETE SOURCEDOCUMENTLINE

      WHERE SOURCEDOCUMENTHEADER IN(

      SELECT SDH.RECID FROM SOURCEDOCUMENTHEADER SDH

      JOIN SQLDICTIONARY SD ON SD.TABLEID = SDH.SOURCERELATIONTYPE AND SD.FIELDID = 0 AND SD.SQLNAME IN('VENDINVOICEJOUR', 'CUSTINVOICEJOUR', 'PURCHREQTABLE')

      JOIN ACCOUNTINGEVENT AE ON AE.SOURCEDOCUMENTHEADER = SDH.RECID AND AE.STATE = 3

      WHERE SDH.ACCOUNTINGSTATUS = 1 AND NOT EXISTS

      (SELECT TOP 1 SOURCEDOCUMENTHEADER FROM ACCOUNTINGEVENT WHERE ACCOUNTINGEVENT.SOURCEDOCUMENTHEADER = SDH.RECID AND ACCOUNTINGEVENT.STATE = 0)

      GROUP BY SDH.RECID, SDH.ACCOUNTINGSTATUS, SDH.SOURCERELATIONTYPE, SDH.TYPEENUMNAME, SDH.TYPEENUMVALUE, SD.SQLNAME, AE.ACCOUNTINGDATE, AE.STATE, AE.RECID)

      AND ACCOUNTINGSTATUS = 1


      --Update SourceDocumentHeader table

      UPDATE SOURCEDOCUMENTHEADER

      SET ACCOUNTINGSTATUS = 2

      WHERE RECID IN(

      SELECT SDH.RECID FROM SOURCEDOCUMENTHEADER SDH

      JOIN SQLDICTIONARY SD ON SD.TABLEID = SDH.SOURCERELATIONTYPE AND SD.FIELDID = 0 AND SD.SQLNAME IN('VENDINVOICEJOUR', 'CUSTINVOICEJOUR', 'PURCHREQTABLE')

      JOIN ACCOUNTINGEVENT AE ON AE.SOURCEDOCUMENTHEADER = SDH.RECID AND AE.STATE = 3

      WHERE SDH.ACCOUNTINGSTATUS = 1 AND NOT EXISTS

      (SELECT TOP 1 SOURCEDOCUMENTHEADER FROM ACCOUNTINGEVENT WHERE ACCOUNTINGEVENT.SOURCEDOCUMENTHEADER = SDH.RECID AND ACCOUNTINGEVENT.STATE = 0)

      GROUP BY SDH.RECID, SDH.ACCOUNTINGSTATUS, SDH.SOURCERELATIONTYPE, SDH.TYPEENUMNAME, SDH.TYPEENUMVALUE, SD.SQLNAME, AE.ACCOUNTINGDATE, AE.STATE, AE.RECID)

 


Tuesday, 14 September 2021

How to find D365FO application build version using X++ and compare with a constant ?

class checkBuildVersion

{   

     public static void main()

    {

        const str latestFixVersion = '10.1.209.0';

        boolean isLatest;

        str appBuildVersion =                                                                                                           Microsoft.Dynamics.BusinessPlatform.ProductInformation.Provider.ProductInfoProvider::get_Provider().ApplicationBuildVersion;

        if( checkBuildVersion::compareVersion(appBuildVersion, latestFixVersion) >=1)

        {

            //if latest version

        }

}


    public static int compareVersion(str _versionStr1, str _versionStr2)

    {

            int subVersion1;

            int subVersion2;

            str versionSeperator = '.';

            container con1 = str2con(_versionStr1, versionSeperator);

            container con2 = str2con(_versionStr2, versionSeperator);

            int maxLength = conLen(con1) > conLen(con2) ? conLen(con1) : conLen(con2);

            int counter = 1;

            for (counter = 1; counter <= maxLength; counter++)

            {

                subVersion1 = conPeek(con1, counter);

                subVersion2 = conPeek(con2, counter);

                if (subVersion1 > subVersion2)

                {

                    return 1;

                }

                else if (subVersion1 < subVersion2)

                {

                    return -1;

                }

            }

            return 0;

        }

}


Monday, 13 September 2021

System Security Duty V2 Entity shows/export stale data even after creating new roles and duties.

 Issue:

System Security Duty V2 (SystemSecurityDutyV2Entity) is showing same export even after creating new roles and duties

Resolution:

You need to batch SecurityRoleDutyPrivilegeExplodedGraphController class. At backend it will run a stored procedure that will refresh with new data. This batch will take very minimal time so admin can schedule the same as per business need. 









Friday, 11 December 2015

Installing and Configuring Load balancer AOS - Dynamics AX 2012

Step to install Load balancer 
  • Install ‘n’-number of AOS required using product CD.
  • In my case I have installed 3 AOS – (2 will be a normal AOS and 1 AOS will act as Load balancer).
  • Important thing to remember is that 1 AOS always be act as Load balancer. Also there will be no license consumed by Load balancer
  • Below image shows list of services I have configured.


  • Have configured client configuration as listed below
  • After exporting the config file you will find all the AOS. Also remember to install the same config on all client systems
.
  • Go to System administration and do cluster configuration

Once the user get login you can see they are equally divided between AOS


















Monday, 9 November 2015

AX 2012 Client crash: System.Runtime.InteropServices.SEHException

Issue


When ever tried to open client got below error:

Application: Ax32.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Runtime.InteropServices.SEHException
Stack:
   at <Module>._wWinMainCRTStartup()

Resolution

Re-install the client

Tuesday, 3 November 2015

TFS integration with AX 2012 R3 CU8

Hi

For any issue with TFS integration with AX 2012 R3 CU8 refer below link

http://blogs.msdn.com/b/axsa/archive/2014/12/02/visual-studio-and-tfs-support-in-ax-2012-r3-cu8.aspx?CommentPosted=true#commentmessage

Happy day :)