Wednesday 3 February 2021

AX365 Deploy a package locally

 1-Create a temp folder

2-Extract the package inside the temp folder

3-open the command prompt as administrator and navigate into the temp folder and run the below scripts as below

AXUpdateInstaller.exe generate -runbookid="Safarirunbook" -topologyfile="DefaultTopologyData.xml" -servicemodelfile="DefaultServiceModelData.xml" -runbookfile="Safarirunbook-runbook.xml"


AXUpdateInstaller.exe import -runbookfile="Safarirunbook-runbook.xml"


AXUpdateInstaller.exe execute -runbookid="Safarirunbook"

in case you want to rerun a step call the below

AXUpdateInstaller.exe execute -runbookid=Safarirunbook -rerunstep=7

Tuesday 2 February 2021

AX365/2012 X++ SQL select statement inside AX

 

  Connection      connection;

        Statement       statement;

        str             query;

        Resultset       resultSet;

        container conComm;

        ;


        // create connection object

        connection = new Connection();


        // create statement

        statement = connection.createStatement();


        // Set the SQL statement

        query = "select ACQUISITIONPRICE,BookID,BookType,Status from AssetBookMerge where AssetID = '" + strAssetId + "'";


        // assert SQL statement execute permission

        new SqlStatementExecutePermission(query).assert();


        // when the query returns result,

        // loop all results for processing

        //BP Deviation documented

        resultSet = statement.executeQuery(query);


        while(resultSet.next())

        {

            // do something with the result

            conComm =[resultSet.getString(1),resultSet.getString(2),resultSet.getString(3),resultSet.getString(4)] ;

        }


        // limit the scope of the assert call

        CodeAccessPermission::revertAssert();

        return conComm;