Wednesday, July 27, 2022

Monday, July 25, 2022

Useful script for D365FO

 


Reference:

https://github.com/TrudAX/TRUDScripts/blob/master/D365FO/UsefulScripts.ps1


List:

https://github.com/d365collaborative/d365fo.tools/wiki

#MaintenanceMod

#SYNC

#INSTALL LICENCE 

#DOWNLOAD DB FROM LCS

#BACKUP TIER1

#RESTORE TIER1 DB on TIER1

#SQL update userinfo set enable= 1

#TRANSFER TO TIER2

#DEPLOY REPORTS

#RESTORE TIER2 TO TIER1

#prepare the database

#IMPORT USERS

#RUN JOB

Tuesday, July 5, 2022

Batch job clean up X++ D365FO

  Connection                      connection;

        Statement                       statement;

        SqlStatementExecutePermission   permission;

        str                             deleteStm;


        if (!Global::isSystemAdministrator())

        {

            error("@SYS130561");

            return;

        }


        connection  = new Connection();

        connection.ttsbegin();


        statement   = connection.createStatement();

        deleteStm = '(SELECT RECID FROM ' + ReleaseUpdateDB::backendTableName(tableNum(Batch)) + ' WHERE GROUPID = \'' + 'TT_BT' + '\')';

        deleteStm = 'DELETE FROM ' + ReleaseUpdateDB::backendTableName(tableNum(BatchConstraints)) + ' WHERE BATCHID IN ' + deleteStm +

            ' OR DEPENDSONBATCHID IN ' + deleteStm + ';';

        permission  = new SqlStatementExecutePermission(deleteStm);

        permission.assert();

        statement.executeUpdate(deleteStm);

        statement.close();

        CodeAccessPermission::revertAssert();


        statement   = connection.createStatement();

        deleteStm = 'DELETE FROM ' + ReleaseUpdateDB::backendTableName(tableNum(Batch)) + ' WHERE GROUPID = \'' + 'TT_BT' + '\';';

        permission  = new SqlStatementExecutePermission(deleteStm);

        permission.assert();

        statement.executeUpdate(deleteStm);

        statement.close();

        CodeAccessPermission::revertAssert();


statement   = connection.createStatement();

        deleteStm = 'DELETE FROM ' + ReleaseUpdateDB::backendTableName(tableNum(BatchJobHistory)) + ' WHERE STATUS != \'' + 3 + '\';';

        permission  = new SqlStatementExecutePermission(deleteStm);

        permission.assert();

        statement.executeUpdate(deleteStm);

        statement.close();

        CodeAccessPermission::revertAssert();


        connection.ttscommit();

        connection = null;

Convert Call stack to readable format in D365FO X++

//Input --container _xppCallStack = xSession::xppCallStack();  Public static str POL_formatXppCallStack(container _xppCallStack, int _skipFr...