Posts

Showing posts from 2019

AX 2012: How to enable or disable execute business operation in CIL using X++

Image
Hi Readers, Today, in this post we are going to tell you a very important topic about execute business operation in CIL, you can enable or disable execute business operation in CIL using X++. Copy the below code and paste it in AX job using AOT. // Created By: Chirag Gupta // Created Date: 27-Dec-2019 // Summary: This job code will be used for enable/disable 'Execute business operation in CIL' checkbox. static void PKA_SetCILExecution(Args _args) {     #LOCALMACRO.FLAG_ExecBusinessOpsWithInterpreter (1 << 10) #ENDMACRO     UserInfo            userInfo;     // setEnable = false; To disable Execute business operation in CIL     // setEnable = true; To enable Execute business operation in CIL     boolean             setEnabled = false;     ttsBegin;     while select forUpdate DebugInfo from user...

AX 2012: How to merge table fields using AX compare tool

Image
Hi Folks, Today, in this post we are going to learn how we can merge table fields using AX compare tool. By default this functionality is disabled in AX. Please follow the below steps: 1) SysCompare class is the core class behind this utility. By adding this single line of code (i.e. highlighted in snapshot below) in selectionChanged method of SysCompare class we can also use this utility for merging of table fields. 2) Navigate to AOT\Classes\SysCompare\selectionChanged (selectionChanged is method name) 3) Right click on selectionChanged Method and click on View Code. 4) Write the following code. allowInsert = true; 5) Please see the screenshot below for your reference. 6) Now after adding this line, we can see the arrow symbol against the table fields too which is used for adding code into the server and it will work like a boom. 7) Please note that modification in SysCompare class may result difficulties in future upgrade of the software as...

AX 2012 - How to add tables in shared/private projects through excel using X++

Image
Hi Readers, Today, in this post we are going to tell you a very important topic. With the help of this article you will get the knowledge, how to add tables in shared/private projects through excel using X++. Let's start... Requirement: We need to create a shared/private project and add all the tables in this with the tables grouping object. Please see the below image for better understanding. As you can see for the above requirement we need to do the following things: Approach 1:   1) Create a shared/private project in the AOT and add a Tables group in it. 2) Add all the AOT tables in this one by one manually. Here, we can get the solution but it's time consuming. So what to do? Well, we can achieve this using X++. Solution: Approach 2: 1. Create a excel file for all the tables in the AOT, for this you can use below SQL Script to fetch all the tables name. -- SQL Script written by Chirag Gupta use [YourModelDBName]  ...

AX 2012 - Update must be performed inside a transaction

Image
Hi Readers, Many times you might have seen below error while you were updating or inserting data using X++. Error: Update must be performed inside a transaction Solution: The solution for the above error is you must keep your updating or inserting code into ttsBegin and ttsCommit. Syntax: ttsBegin; // Your_Code ttsCommit; Example: Copy code from below: // Code written by Chirag Gupta static void updateRebateData(Args _args) {     PdsRebateTable          pdsRebateTable;     PdsRebateAgreement      pdsRebateAgreement;     PdsRebateAgreementLine  pdsRebateAgreementLine;     int                     counter = 0;         while select forUpdate pdsRebateAgreementLine         join pdsRebateAgreement             where pdsRebateAgreementLine.RebateAgr...

AX 2012 - How to fix content within this application coming from the website listed below is being blocked by the Internet Explorer Enhanced Security Configuration

Image
Hi Readers, Today, in this post we will share the solution of below issue while code comparison in AX 2012. You might have seen below error several times but do you know, you can solve this frustrating situation by following below steps. Let's start... Issue : Content within this application coming from the website listed below is being blocked by the Internet Explorer Enhanced Security Configuration. about:security_AX32.exe Solution: 1. Logout from AX. 2. Open Server Manager like below image. 3. Click on IE Enhanced Security Configuration 'On' button, a new form will open. In new form click on 'Off' button for Administrators and Users and refresh the Server Manager like below image. 4. Now, you can see IE Enhanced Security Configuration status is 'Off'. 5. Now, login to your AX and check, issue will be fixed permanently. We hope this solution helped you for being frustrated over code comparison issue. ...

AX 2012 - Error in CIL Generation: "CIL generation: Object reference not set to an instance of an object."

Image
Hi Readers, Today, in this post we will share a very important solution about the following error: Error: Error in CIL Generation : "CIL generation: Object reference not set to an instance of an object." Err:351 We got the above error while doing Full CIL. You may get this error after a incremental or Full CIL. Solution : 1. Go to AX services and stop the AOS. 2. Go to C:\Program Files\Microsoft Dynamics AX\60\Server\Microsoft_Dynamics_AX\bin and rename XppIL folder as XppIL_Old. After successful CIL we will delete XppIL_Old folder and a new XppIL folder will be automatically created in this folder by AX. 3. Start the AOS services. 4. Login to AX. 5. Go to development environment by pressing CTRL + D and generate Full CIL. 6. If you are still getting the errors after Full CIL please check the objects individually which are throwing the errors and resolve them. 7. Once all the errors are resolved compile them. Please click here to know...

AX 2012 - Error during CIL: System.OperationCanceledException: AIF service group not activated.

Image
Hi Readers, Today, in this post we are going to share a solution for the below error. We got the below error while doing Full CIL. Error : System.OperationCanceledException: AIF service group not activated.  Service group: FinancialDimensionServices.  Error: Type 'Dynamics.Ax.Application.BudgetDimensionValidationStatusContract' cannot inherit from a type that is not marked with DataContractAttribute or SerializableAttribute.  Consider marking the base type 'Dynamics.Ax.Application.DimensionValidationStatusProcessor' with DataContractAttribute or SerializableAttribute, or removing them from the derived type. ---> System.Runtime.Serialization.InvalidDataContractException: Type 'Dynamics.Ax.Application.BudgetDimensionValidationStatusContract' cannot inherit from a type that is not marked with DataContractAttribute or SerializableAttribute.  Consider marking the base type 'Dynamics.Ax.Application.DimensionValidationStatusProcessor' with DataContrac...

AX 2012 - How to create Progress Indicators | Single Progress Indicator using X++

Hi Readers, Today, in this post we will talk about how to create a single use progress indicator in AX 2012 R2/R3 and D365 FO using X++. Please create a AX Job in AOT and copy paste the below code: // Code written by Chirag Gupta static void progressIndicatorExample(Args _args) {     #AviFiles     SysOperationProgress progress = new SysOperationProgress();     int i;       ;       progress.setCaption("My Task");     progress.setAnimation(#AviUpdate);     progress.setTotal(300000);     for (i = 1; i <= 300000; i++)     {         progress.setText(strfmt("Step %1", i));         progress.setCount(i, 1);     } } If you want to read more about this topic please click here Comment below if you find this article helpful... Author : Chirag Gupta Microsoft Dynamics 365 AX Technical Consultant at IBM Bangalore Da...

AX 2012 - All modules are not visible in AX client

Image
Hi Readers, Today, in this post we are going to share a very important knowledge about AX installation issue. We installed AX R3 in our system and after that we installed Cumulative Update 13 (CU13). But after installing CU13 we faced a very weird issue that all modules were not visible in AX client. Note: You can see the modules individually by clicking on File/View/Modules and click on each and every module one by one like below image. But this is not permanent solution for this issue. As once you login again all modules will disappear. For permanent solution please check the below steps. Solution: We research on this topic and find out the solution for that. Please have a look at the below points, we hope if you are facing this similar issue you can get rid of this easily. 1. Go to DAT/System administration/Area page/Setup/Licensing/License information, a new form will open like below image. 2. Browse and load license file, provided by your Clien...

AX 2012 - Compile and compile forward

Image
Hi Folks, Today, in this post we will talk about very interesting topic: Compile and compile forward. Well, compilation is a process which converts X++ Code into P-Code. Compilation mostly used when there are stack trace errors and AX crash because of it. Difference between compile and compile forward: Compile: Compilation can be done for all the objects in the AOT. We can do the compilation in 6 ways which are following: 1) Individual objects compilation: (Select the object, right click and choose compile) 2. Group objects compilation:  (Select the objects group, right click and choose compile) 3. Entire application compilation from the AOT (Application object tree): (Right click on the AOT and choose compile) 4. Entire application compilation from the front end. (Go to System administration/Area Page/Periodic and click on compile application) 5. Parallel compilation using command prompt. To know more please click here Compile forward:...

AX 2012 - How to send SSRS report in email as an attachment using X++

Hi Technical, Today, in this post we will share, how you can send SSRS report in email as an attachment using X++. Please find the below code... // Created by: Chirag Gupta // Created date: 17-Sep-19 // Summary: Send SSRS Report in excel format as attachment in email. public void EmailSSRSReport(Args _args) {     SrsReportRunController controller = new SrsReportRunController();     SRSPrintDestinationSettings printSettings;     SrsReportEMailDataContract  emailContract;     // set report name     controller.parmReportName(ssrsReportStr(RMPMBPRReport, Report));     // create email contract     emailContract = new SrsReportEMailDataContract();     // fill in the email contract details     emailContract.parmAttachmentFileFormat(SRSReportFileFormat::Excel);     emailContract.parmSubject("RMPM BPR Report " + strUpr(curext()));     emailContract.parmBody(...

AX 2012 - roundDownDec method syntax and example

Hi Folks, Please find below code for roundDownDec method in AX 2012. Global::roundDownDec Method [AX 2012] Syntax client server public static real roundDownDec(real value, int numDec) Run On Called Parameters value Type: real numDec Type: int Example: // Code written by Chirag Gupta // Summary: This code will round the value till two decimals; // You can change the roundDownDec(_args1, _args2) second argument according to your need. server static void roundDownDecExample(Args _args) {     real r = 37563.5343100000000000;     real a;     a = roundDownDec(r, 2);     r = a;     info(strFmt("%1", r)); } // Output for the above code will be 37563.53 Author: Chirag Gupta Microsoft Dynamics 365 AX Technical Consultant at IBM Bangalore Date: 17-Sep-2019 Happy Learning !!

[Error] - Error in unit of amount in currency KES. Must be rounded to 0.01 | The unit of 37.563.5343100000000000 KES being posted to account 32710001-- is outside the current penny rounding threshold | Posting has been canceled

Image
Hi Readers, Today, in this article we will share a very known issue of AX, most of the people are still struggling to find out the solution for the below error. We got this error when we were posting Ledger Journal using X++. One of the developers find out the solution for the below error so we are posting the solution here. Error : Error in unit of amount in currency KES. Must be rounded to 0.01. The unit of 37.563.5343100000000000 KES being posted to account 32710001-- is outside the current penny rounding threshold. Posting has been canceled. Solution : 1. Check in your code, how you are inserting Amount for Credit and Debit for Ledger Journal posting. 2. Make Amount field value till two decimals use roundDownDec method. 3. Please see the below code, we have written a AX Job to illustrate. // Code written by Chirag Gupta server static void roundDownDecExample(Args _args) {     real r = 37563.5343100000000000;     real a;   ...

AX 2012 - How to stop AOS when services got stuck at stopping status

Image
Hello Technical, Today, in this post we are going to share a very important solution when AOS services get stuck in stopping status. You might have seen sometimes when we restarted the AOS services and it get stuck in stopping phase and we need to do server restart but this solution tells you not to stop AOS when services got stuck. Let's talk about the solution... 1. Check AOS services status, if services are in stopping state then please do it like step 2. 2. Open Even Viewer and expand Windows Logs. 3. Click on Application and select Filter Current Log. 4. Filter Event Id by '149' in Filter Current Log form. 5. Select the latest information by Date and Time of event id. 6. Find the PID of AOS which you want to stop. 7. Open Task Manager. Note : *If the “PID” column is not shown, click on View > Select columns > Check the PID > Click “OK” 8.  Select the Ax32Serv.exe which has the same PID number as you found in Step #6. Your process ...

AX 2012 - How to make a form field mandatory

Image
Hello Readers, Some days ago, we had come across a requirement that we need to make a form field mandatory. We are sharing this article to help you to understand how you can achieve the same requirement. Requirement : Make 'document date' mandatory for Invoice Journal Lines form. Solution : 1. Go to Accounts payable/Area page/Journals/Invoices/Invoice Journal, Invoice journal form will open like below... 2. Click on lines in invoice journal form, journal voucher form will open. 3. Right click on document date field and click on personalize. You can see AOT form name to be edit. Click on edit button like below... 4. Expand the designs node of this form and make the document date mandatory after selecting mandatory = yes in the form properties. 5. Now, form document date field has been mandatory, if you try to save the form data without document date it will through an error like "Field 'Document date' must be filled in." ...