Wednesday 21 June 2023

SSRS Process report query::insert_recordset

  public void processReport()

    {

        CompanyInfo          companyInfo;

        List                 itemIdList = new List(Types::String), itemGroupList = new List(Types::String);

        ALM_InventFormulaDynParameter _ALM_InventFormulaDynParameter;

        InventTableModule                           _inventTableModule;

        InventTableExpanded _InventTableExpanded;


        contract             = this.parmDataContract() as Alm_InventFormulaContract;

        fromDate             = contract.parmFromDate();

        toDate               = contract.parmToDate();

        itemIdList           = contract.parmItemId();

        itemGroupList        = contract.parmItemGroup();


        testItemId           = itemIdList.toString();

        testItemId           = strRem(testItemId,"<");

        testItemId           = strRem(testItemId,">");


        testItemGroup        = itemGroupList.toString();

        testItemGroup        = strRem(testItemGroup,"<");

        testItemGroup        = strRem(testItemGroup,">");


        //deleting data in stagging table

        ttsbegin;

        delete_from inventFormulaStagging where inventFormulaStagging.CreatedBy == curUserId();

        ttscommit;


        while select _ALM_InventFormulaDynParameter

        {

            if(_ALM_InventFormulaDynParameter.ALM_ColumnSource == ALM_ColumnSource::InventTransaction)

            {

                if(_ALM_InventFormulaDynParameter.InventTransPostingType == InventTransPostingType::Financial)

                   this.insertingIntoStaggingInventTrans(_ALM_InventFormulaDynParameter);

                else  if(_ALM_InventFormulaDynParameter.InventTransPostingType == InventTransPostingType::Physical)

                   this.insertingIntoStaggingInventTransPhysical(_ALM_InventFormulaDynParameter);

            }

            else if(_ALM_InventFormulaDynParameter.ALM_ColumnSource == ALM_ColumnSource::SalesTransaction)

                 this.insertingIntoStaggingCustomer(_ALM_InventFormulaDynParameter);

        }


        select firstonly forupdate inventFormulaStagging;

        {

            if(inventFormulaStagging)

            {

                inventFormulaStagging.CompanyName      = CompanyInfo::find().Name;

                inventFormulaStagging.CompanyLogo      = Formletter::companyLogo();


                ttsbegin;

                inventFormulaStagging.update();

                ttscommit;

            }

        }


        update_recordset inventFormulaStagging

        setting ItemName = _InventTableExpanded.ProductName,               

                UOM          = _inventTableModule.UnitId,

               ItemGroup = _InventTableExpanded.ItemGroupId

               

        join ProductName,ItemGroupId from _InventTableExpanded

        where _InventTableExpanded.ItemId == inventFormulaStagging.ItemId

        join UnitId from _inventTableModule

        where _inventTableModule.ItemId == _InventTableExpanded.ItemId && _inventTableModule.ModuleType == ModuleInventPurchSales::Invent;


        while select ItemId,count(RecId) from  inventFormulaStagging

            group by inventFormulaStagging.ItemId

            where inventFormulaStagging.CreatedBy == curUserId()

        {

            this.updateOpenBalance(inventFormulaStagging.ItemId,0);

        }

    }


public void insertingIntoStaggingInventTransPhysical(ALM_InventFormulaDynParameter _ALM_InventFormulaDynParameter)

    {

        Alm_InventFormulaView              inventFormulaView;

        ALM_InventFormulaSalesView         inventFormulaSalesView;

       

        InventTransOrigin                  inventTransOrigin;

        InventTransPosting                 inventTransPosting;

        DimensionAttributeValueCombination combination;

        RetailTransactionSalesTrans        salesTrans;

        InventTable                        inventTable;

        InventTrans                        inventTrans;

        TransDate                          openBalDate = fromDate - 1;

      

        Query                               query;

        QueryBuildDataSource                qbds;

        QueryBuildFieldList                 fldList_InventFormulaStagging;

        Map                                 fieldMapping;



      


        

        query   = new Query();


        qbds    = query.addDataSource(tableNum(ALM_InventFormulaViewPhysical));


        qbds.addRange(fieldNum(ALM_InventFormulaViewPhysical, DatePhysical)).value(SysQuery::range(fromDate,toDate));


        if(testItemId)

        {

            qbds.addRange(fieldNum(ALM_InventFormulaViewPhysical, ItemId)).value(testItemId);

        }

        //if(testItemGroup)

        //{

        //    qbds.addRange(fieldNum(ALM_InventFormulaViewPhysical, ItemGroup)).value(testItemGroup);

        //}


        if(_ALM_InventFormulaDynParameter.Account !="")

        {

            qbds.addRange(fieldNum(ALM_InventFormulaViewPhysical, MainAccountValue)).value(_ALM_InventFormulaDynParameter.Account);

        }


    


        qbds.addRange(fieldNum(ALM_InventFormulaViewPhysical, InventTransPostingType)).value(SysQuery::value( _ALM_InventFormulaDynParameter.InventTransPostingType));


        if(_ALM_InventFormulaDynParameter.ALM_InventFromulaInventTransType != ALM_InventFromulaInventTransType::All)

        {

            if(_ALM_InventFormulaDynParameter.ALM_InventFromulaInventTransType == ALM_InventFromulaInventTransType::InventTransaction)

               qbds.addRange(fieldNum(ALM_InventFormulaViewPhysical, ReferenceCategory)).value(SysQuery::value( InventTransType::InventTransaction));

            if(_ALM_InventFormulaDynParameter.ALM_InventFromulaInventTransType == ALM_InventFromulaInventTransType::ProdLine)

                qbds.addRange(fieldNum(ALM_InventFormulaViewPhysical, ReferenceCategory)).value(SysQuery::value( InventTransType::ProdLine));

            if(_ALM_InventFormulaDynParameter.ALM_InventFromulaInventTransType == ALM_InventFromulaInventTransType::Purch)

                qbds.addRange(fieldNum(ALM_InventFormulaViewPhysical, ReferenceCategory)).value(SysQuery::value( InventTransType::Purch));

            if(_ALM_InventFormulaDynParameter.ALM_InventFromulaInventTransType == ALM_InventFromulaInventTransType::Sales)

                qbds.addRange(fieldNum(ALM_InventFormulaViewPhysical, ReferenceCategory)).value(SysQuery::value( InventTransType::Sales));

        

        }


        if(_ALM_InventFormulaDynParameter.ALM_InventFormulaDynInOutStatus != ALM_InventFormulaDynInOutStatus::Both)

        {

            if  (_ALM_InventFormulaDynParameter.ALM_InventFormulaDynInOutStatus == ALM_InventFormulaDynInOutStatus::Purchased)

                qbds.addRange(fieldNum(ALM_InventFormulaViewPhysical, StatusReceipt)).value(SysQuery::value( StatusReceipt::Purchased));


            else if(_ALM_InventFormulaDynParameter.ALM_InventFormulaDynInOutStatus == ALM_InventFormulaDynInOutStatus::Sold)

                qbds.addRange(fieldNum(ALM_InventFormulaViewPhysical, StatusIssue)).value(SysQuery::value( StatusIssue::Sold));

        }


        qbds.addGroupByField(fieldNum(ALM_InventFormulaViewPhysical, ItemId));

      

     


        qbds.fields().clearFieldList();

        fldList_InventFormulaStagging = qbds.fields();

        

     

        fldList_InventFormulaStagging = qbds.fields();

        fldList_InventFormulaStagging.addField(fieldNum(ALM_InventFormulaViewPhysical, ItemId));

        //fldList_InventFormulaStagging.addField(fieldNum(Alm_InventFormulaView, Account));

        fldList_InventFormulaStagging.addField(fieldNum(ALM_InventFormulaViewPhysical, CostAmountPosted), SelectionField::Sum);

        fldList_InventFormulaStagging.addField(fieldNum(ALM_InventFormulaViewPhysical, CostAmountAdjustment), SelectionField::Sum);

        fldList_InventFormulaStagging.addField(fieldNum(ALM_InventFormulaViewPhysical, defaultvalue), SelectionField::Sum);

        fldList_InventFormulaStagging.addField(fieldNum(ALM_InventFormulaViewPhysical, Qty), SelectionField::Sum);

        fldList_InventFormulaStagging.dynamic(QueryFieldListDynamic::No);


        fieldMapping    = new Map(Types::String, Types::Container);

        fieldmapping.insert(fieldstr(ALM_InventFormulaDynStagging, ItemId), [qbds.uniqueid(), fieldstr(ALM_InventFormulaViewPhysical, ItemId)]);

        fieldmapping.insert(fieldstr(ALM_InventFormulaDynStagging, CostAmount), [qbds.uniqueid(), SysComputedColumn::sum(fieldstr(ALM_InventFormulaViewPhysical, CostAmountPosted))]);

        fieldmapping.insert(fieldstr(ALM_InventFormulaDynStagging, CostAmountAdj), [qbds.uniqueid(), SysComputedColumn::sum(fieldstr(ALM_InventFormulaViewPhysical, CostAmountAdjustment))]);

        fieldmapping.insert(fieldstr(ALM_InventFormulaDynStagging, Sequence), [qbds.uniqueid(), SysComputedColumn::sum(fieldstr(ALM_InventFormulaViewPhysical, defaultvalue))]);

        fieldmapping.insert(fieldstr(ALM_InventFormulaDynStagging, Qty), [qbds.uniqueid(), SysComputedColumn::sum(fieldstr(ALM_InventFormulaViewPhysical, Qty))]);

        //     fieldmapping.insert(fieldstr(ALM_InventFormulaDynStagging, Account), [qbds.uniqueid(), "'dfsdfdsf' as Account"]);

        query::insert_recordset(inventFormulaStagging, fieldMapping, query);


        update_recordset inventFormulaStagging

            setting Account = _ALM_InventFormulaDynParameter.Account,

            Sequence =  _ALM_InventFormulaDynParameter.Sequence,

            Description = _ALM_InventFormulaDynParameter.Description,

            CostAmount = inventFormulaStagging.CostAmount + inventFormulaStagging.CostAmountAdj,

            ALM_InventFormulaDynInOut = _ALM_InventFormulaDynParameter.ALM_InventFormulaDynInOut

            where inventFormulaStagging.Sequence <= -1 && inventFormulaStagging.CreatedBy == curUserId();

    }


Sunday 4 September 2022

The headquarter Real-time Service call failed due to security reason Development One Box version 24

After downloading the latest dev machine version 24 from the LCS and trying to run real-time service or run the download jobs you will face 2 main issues


first, the Real-time service is not running or failing as in the below image.

  1. Edit the C:\RetailServer\webroot\bin\CommerceRunTime.Config file
  2. Locate this line: <add key="audienceUrn" value="spn:00000015-0000-0000-c000-000000000000" />
  3. Replace the Number values with the same Azure AD Application(Client) ID value that was created at the beginning of the deployment
  4. Save the Change
  5. Restart the Retail Server Website.

Second, while opening the channel database group the above image. 




 


  1. The required data encryption certificate was not found when trying to edit the Database connection profile table and the ConnectionString field. Please add a valid certificate. Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionException: Encryption error occured with exception: Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionException: Encryption error occured with exception: Microsoft.Dynamics.AX.Configuration.CertificateHandler.NoCertificateFoundException: No certificate found for id '7366E25DC94FA8A400FA0037FFF3BB300D9482D4'. at Microsoft.Dynamics.AX.Configuration.CertificateHandler.CertificateHandlerBase.GetCertificateFromLocalStore(X509FindType findType, String findValue) at Microsoft.Dynamics.AX.Configuration.CertificateHandler.CertificateHandlerBase.GetFirstCertificateForId(String id) at Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionEngine.GetCryptoServiceProviderByThumbprintBuffer(String idList, String thumbprint) ---> Microsoft.Dynamics.AX.Configuration.CertificateHandler.NoCertificateFoundException: No certificate found for id '7366E25DC94FA8A400FA0037FFF3BB300D9482D4'. at Microsoft.Dynamics.AX.Configuration.CertificateHandler.CertificateHandlerBase.GetCertificateFromLocalStore(X509FindType findType, String findValue) at Microsoft.Dynamics.AX.Configuration.CertificateHandler.CertificateHandlerBase.GetFirstCertificateForId(String id) at Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionEngine.GetCryptoServiceProviderByThumbprintBuffer(String idList, String thumbprint) --- End of inner exception stack trace --- at Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionEngine.GetCryptoServiceProviderByThumbprintBuffer(String idList, String thumbprint) at Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionEngine.DecryptData(Byte[] cipher, Boolean validateSignature, String& purpose, Int32 purposeLength, Int32& dataLength, Int32 encryptAlgorithmType, String& encryptCertThumbprint, String& signingCertThumbprint, EncryptionHeader encryptedHeader, EncryptionConfig decryptionConfig, Boolean useThumbprintFromPayload) at Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionEngine.DecryptionInternalV2(Byte[] cipher, Boolean validateSignature, String purpose) ---> Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionException: Encryption error occured with exception: Microsoft.Dynamics.AX.Configuration.CertificateHandler.NoCertificateFoundException: No certificate found for id '7366E25DC94FA8A400FA0037FFF3BB300D9482D4'. at Microsoft.Dynamics.AX.Configuration.CertificateHandler.CertificateHandlerBase.GetCertificateFromLocalStore(X509FindType findType, String findValue) at Microsoft.Dynamics.AX.Configuration.CertificateHandler.CertificateHandlerBase.GetFirstCertificateForId(String id) at Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionEngine.GetCryptoServiceProviderByThumbprintBuffer(String idList, String thumbprint) ---> Microsoft.Dynamics.AX.Configuration.CertificateHandler.NoCertificateFoundException: No certificate found for id '7366E25DC94FA8A400FA0037FFF3BB300D9482D4'. at Microsoft.Dynamics.AX.Configuration.CertificateHandler.CertificateHandlerBase.GetCertificateFromLocalStore(X509FindType findType, String findValue) at Microsoft.Dynamics.AX.Configuration.CertificateHandler.CertificateHandlerBase.GetFirstCertificateForId(String id) at Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionEngine.GetCryptoServiceProviderByThumbprintBuffer(String idList, String thumbprint) --- End of inner exception stack trace --- at Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionEngine.GetCryptoServiceProviderByThumbprintBuffer(String idList, String thumbprint) at Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionEngine.DecryptData(Byte[] cipher, Boolean validateSignature, String& purpose, Int32 purposeLength, Int32& dataLength, Int32 encryptAlgorithmType, String& encryptCertThumbprint, String& signingCertThumbprint, EncryptionHeader encryptedHeader, EncryptionConfig decryptionConfig, Boolean useThumbprintFromPayload) at Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionEngine.DecryptionInternalV2(Byte[] cipher, Boolean validateSignature, String purpose) --- End of inner exception stack trace --- at Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionEngine.DecryptionInternalV2(Byte[] cipher, Boolean validateSignature, String purpose) at Microsoft.Dynamics.Ax.Xpp.Security.EncryptionEngine.Decrypt(Byte[] cipher, String purpose) at Dynamics.AX.Application.Global.`editEncryptedStringField(Common _common, String value, Int32 _fieldId, Boolean _set) in xppSource://Source/ApplicationPlatform\AxClass_Global.xpp:line 10096
  2. The required data encryption certificate was not found when trying to edit the Database connection profile table and the ConnectionString field. Please add a valid certificate. Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionException: Encryption error occured with exception: Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionException: Encryption error occured with exception: Microsoft.Dynamics.AX.Configuration.CertificateHandler.NoCertificateFoundException: No certificate found for id '7366E25DC94FA8A400FA0037FFF3BB300D9482D4'. at Microsoft.Dynamics.AX.Configuration.CertificateHandler.CertificateHandlerBase.GetCertificateFromLocalStore(X509FindType findType, String findValue) at Microsoft.Dynamics.AX.Configuration.CertificateHandler.CertificateHandlerBase.GetFirstCertificateForId(String id) at Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionEngine.GetCryptoServiceProviderByThumbprintBuffer(String idList, String thumbprint) ---> Microsoft.Dynamics.AX.Configuration.CertificateHandler.NoCertificateFoundException: No certificate found for id '7366E25DC94FA8A400FA0037FFF3BB300D9482D4'. at Microsoft.Dynamics.AX.Configuration.CertificateHandler.CertificateHandlerBase.GetCertificateFromLocalStore(X509FindType findType, String findValue) at Microsoft.Dynamics.AX.Configuration.CertificateHandler.CertificateHandlerBase.GetFirstCertificateForId(String id) at Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionEngine.GetCryptoServiceProviderByThumbprintBuffer(String idList, String thumbprint) --- End of inner exception stack trace --- at Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionEngine.GetCryptoServiceProviderByThumbprintBuffer(String idList, String thumbprint) at Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionEngine.DecryptData(Byte[] cipher, Boolean validateSignature, String& purpose, Int32 purposeLength, Int32& dataLength, Int32 encryptAlgorithmType, String& encryptCertThumbprint, String& signingCertThumbprint, EncryptionHeader encryptedHeader, EncryptionConfig decryptionConfig, Boolean useThumbprintFromPayload) at Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionEngine.DecryptionInternalV2(Byte[] cipher, Boolean validateSignature, String purpose) ---> Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionException: Encryption error occured with exception: Microsoft.Dynamics.AX.Configuration.CertificateHandler.NoCertificateFoundException: No certificate found for id '7366E25DC94FA8A400FA0037FFF3BB300D9482D4'. at Microsoft.Dynamics.AX.Configuration.CertificateHandler.CertificateHandlerBase.GetCertificateFromLocalStore(X509FindType findType, String findValue) at Microsoft.Dynamics.AX.Configuration.CertificateHandler.CertificateHandlerBase.GetFirstCertificateForId(String id) at Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionEngine.GetCryptoServiceProviderByThumbprintBuffer(String idList, String thumbprint) ---> Microsoft.Dynamics.AX.Configuration.CertificateHandler.NoCertificateFoundException: No certificate found for id '7366E25DC94FA8A400FA0037FFF3BB300D9482D4'. at Microsoft.Dynamics.AX.Configuration.CertificateHandler.CertificateHandlerBase.GetCertificateFromLocalStore(X509FindType findType, String findValue) at Microsoft.Dynamics.AX.Configuration.CertificateHandler.CertificateHandlerBase.GetFirstCertificateForId(String id) at Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionEngine.GetCryptoServiceProviderByThumbprintBuffer(String idList, String thumbprint) --- End of inner exception stack trace --- at Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionEngine.GetCryptoServiceProviderByThumbprintBuffer(String idList, String thumbprint) at Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionEngine.DecryptData(Byte[] cipher, Boolean validateSignature, String& purpose, Int32 purposeLength, Int32& dataLength, Int32 encryptAlgorithmType, String& encryptCertThumbprint, String& signingCertThumbprint, EncryptionHeader encryptedHeader, EncryptionConfig decryptionConfig, Boolean useThumbprintFromPayload) at Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionEngine.DecryptionInternalV2(Byte[] cipher, Boolean validateSignature, String purpose) --- End of inner exception stack trace --- at Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionEngine.DecryptionInternalV2(Byte[] cipher, Boolean validateSignature, String purpose) at Microsoft.Dynamics.Ax.Xpp.Security.EncryptionEngine.Decrypt(Byte[] cipher, String purpose) at Dynamics.AX.Application.Global.`editEncryptedStringField(Common _common, String value, Int32 _fieldId, Boolean _set) in xppSource://Source/ApplicationPlatform\AxClass_Global.xpp:line 10096
  3. The required data encryption certificate was not found when trying to edit the Database connection profile table and the ConnectionString field. Please add a valid certificate. Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionException: Encryption error occured with exception: Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionException: Encryption error occured with exception: Microsoft.Dynamics.AX.Configuration.CertificateHandler.NoCertificateFoundException: No certificate found for id '7366E25DC94FA8A400FA0037FFF3BB300D9482D4'. at Microsoft.Dynamics.AX.Configuration.CertificateHandler.CertificateHandlerBase.GetCertificateFromLocalStore(X509FindType findType, String findValue) at Microsoft.Dynamics.AX.Configuration.CertificateHandler.CertificateHandlerBase.GetFirstCertificateForId(String id) at Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionEngine.GetCryptoServiceProviderByThumbprintBuffer(String idList, String thumbprint) ---> Microsoft.Dynamics.AX.Configuration.CertificateHandler.NoCertificateFoundException: No certificate found for id '7366E25DC94FA8A400FA0037FFF3BB300D9482D4'. at Microsoft.Dynamics.AX.Configuration.CertificateHandler.CertificateHandlerBase.GetCertificateFromLocalStore(X509FindType findType, String findValue) at Microsoft.Dynamics.AX.Configuration.CertificateHandler.CertificateHandlerBase.GetFirstCertificateForId(String id) at Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionEngine.GetCryptoServiceProviderByThumbprintBuffer(String idList, String thumbprint) --- End of inner exception stack trace --- at Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionEngine.GetCryptoServiceProviderByThumbprintBuffer(String idList, String thumbprint) at Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionEngine.DecryptData(Byte[] cipher, Boolean validateSignature, String& purpose, Int32 purposeLength, Int32& dataLength, Int32 encryptAlgorithmType, String& encryptCertThumbprint, String& signingCertThumbprint, EncryptionHeader encryptedHeader, EncryptionConfig decryptionConfig, Boolean useThumbprintFromPayload) at Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionEngine.DecryptionInternalV2(Byte[] cipher, Boolean validateSignature, String purpose) ---> Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionException: Encryption error occured with exception: Microsoft.Dynamics.AX.Configuration.CertificateHandler.NoCertificateFoundException: No certificate found for id '7366E25DC94FA8A400FA0037FFF3BB300D9482D4'. at Microsoft.Dynamics.AX.Configuration.CertificateHandler.CertificateHandlerBase.GetCertificateFromLocalStore(X509FindType findType, String findValue) at Microsoft.Dynamics.AX.Configuration.CertificateHandler.CertificateHandlerBase.GetFirstCertificateForId(String id) at Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionEngine.GetCryptoServiceProviderByThumbprintBuffer(String idList, String thumbprint) ---> Microsoft.Dynamics.AX.Configuration.CertificateHandler.NoCertificateFoundException: No certificate found for id '7366E25DC94FA8A400FA0037FFF3BB300D9482D4'. at Microsoft.Dynamics.AX.Configuration.CertificateHandler.CertificateHandlerBase.GetCertificateFromLocalStore(X509FindType findType, String findValue) at Microsoft.Dynamics.AX.Configuration.CertificateHandler.CertificateHandlerBase.GetFirstCertificateForId(String id) at Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionEngine.GetCryptoServiceProviderByThumbprintBuffer(String idList, String thumbprint) --- End of inner exception stack trace --- at Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionEngine.GetCryptoServiceProviderByThumbprintBuffer(String idList, String thumbprint) at Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionEngine.DecryptData(Byte[] cipher, Boolean validateSignature, String& purpose, Int32 purposeLength, Int32& dataLength, Int32 encryptAlgorithmType, String& encryptCertThumbprint, String& signingCertThumbprint, EncryptionHeader encryptedHeader, EncryptionConfig decryptionConfig, Boolean useThumbprintFromPayload) at Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionEngine.DecryptionInternalV2(Byte[] cipher, Boolean validateSignature, String purpose) --- End of inner exception stack trace --- at Microsoft.Dynamics.Ax.Xpp.Security.CryptoEncryptionEngine.DecryptionInternalV2(Byte[] cipher, Boolean validateSignature, String purpose) at Microsoft.Dynamics.Ax.Xpp.Security.EncryptionEngine.Decrypt(Byte[] cipher, String purpose) at Dynamics.AX.Application.Global.`editEncryptedStringField(Common _common, String value, Int32 _fieldId, Boolean _set) in xppSource://Source/ApplicationPlatform\AxClass_Global.xpp:line 10096


Open the LCS >> Shared asset library >>  try to get the latest quality update according to our case we will select Final Quality Update - 10.0.24


1-extract the package you will find PowerShell script located in retail server >> Scripts >> RetrageRetailServer.ps1

2-Run the script as an administrator

3-Refresh the page you will find the error is gone and the download jobs are working fine.

Thursday 7 July 2022

AX365 get Enum values from SQL through Enum name

  select t1.*, t2.* from ENUMIDTABLE t1 inner join ENUMVALUETABLE t2 on t1.ID=t2.ENUMID where t1.NAME='InventTransType'


Tuesday 15 February 2022

SQL Server query to get all the deadlock process

SELECT db.name DBName, tl.request_session_id, wt.blocking_session_id, OBJECT_NAME(p.OBJECT_ID) BlockedObjectName, tl.resource_type, h1.TEXT AS RequestingText, h2.TEXT AS BlockingTest, tl.request_mode FROM sys.dm_tran_locks AS tl INNER JOIN sys.databases db ON db.database_id = tl.resource_database_id INNER JOIN sys.dm_os_waiting_tasks AS wt ON tl.lock_owner_address = wt.resource_address INNER JOIN sys.partitions AS p ON p.hobt_id = tl.resource_associated_entity_id INNER JOIN sys.dm_exec_connections ec1 ON ec1.session_id = tl.request_session_id INNER JOIN sys.dm_exec_connections ec2 ON ec2.session_id = wt.blocking_session_id CROSS APPLY sys.dm_exec_sql_text(ec1.most_recent_sql_handle) AS h1 CROSS APPLY sys.dm_exec_sql_text(ec2.most_recent_sql_handle) AS h2

Sunday 6 February 2022

AX 2012 Full CIL Compile steps

 1) Stop all relevant AOS server(s)

2) On your relevant AOS server(s) navigate to the following folder (default) using Windows Explorer:
C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin\XppIL

3) Make sure you create a safe copy of the XPPIL folder content to another new local folder on the AOS computer (example: C:\XPPIL_SAVE)

4) Now delete all folders and files inside the folder “C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin\XppIL” but keep the folder “XPPIL” itself.

5) Start all AOS server(s)

6) Run a full CIL creation from AOT. This will create a fresh rebuild of all files/ folders inside the XPPIL folder

Thursday 23 December 2021

AX 2012 X++ Adjust sales order line Tax

 SalesTable              _SalesTable; 

    SalesLine               _SalesLine;

    TaxRegulation           taxRegulation;

    super();

    

   

 

    _SalesTable = SalesTable::find(SalesTable.SalesId);

    _SalesLine  = SalesLine::find(_SalesTable.SalesId,SalesLine.LineNum);

     

    taxRegulation = TaxRegulation::newTaxRegulation(

           SalesTotals::getTax(_SalesTable),

            null,                                                    

            tableNum(SalesLine),

            SalesLine.RecId

    );

 

    if(taxRegulation)

    {

        taxRegulation.allocateAmount(20);

        taxRegulation.saveTaxRegulation();

    }

Sunday 19 December 2021

AX 365 Deploy SSRS report through Power Shell

 C:\AosService\PackagesLocalDirectory\Plugins\AxReportVmRoleStartupTask\DeployAllReportsToSSRS.ps1 -PackageInstallLocation "C:\AosService\PackagesLocalDirectory" -ReportName SalesInvoiceCopy1*