Posts

Showing posts from 2025

One time runnable job for production with deployable package

 Class NGUpdateFixedAsNoRunnableJob {     /// <summary>     /// Class entry point. The system will call this method when a designated menu      /// is selected or when execution starts and this class is set as the startup class.     /// --> Update the fixed asset number in US30 & Uk30  <--     /// </summary>     /// <param name = "_args">The specified arguments.</param>     public static void main(Args _args)     {         ProjTable  projTable;         Container con =["US30","UK30"];                 while select  projTable    //crosscompany:con             where (projTable.ProjId == 'C004436-01')                 || (projTable.ProjId == 'PJUS000245_01') || (projTable.ProjId == 'PJUS000245_02')...

Hide work order state on the asset work order form using role based

/// <summary> /// Class EntAssetLifecycleStateUpdate event handlers /// </summary> class VTEntAssetLifecycleStateUpdateEventHandlers {     /// <summary>     ///  Post init based on role removing acces to finish     /// </summary>     /// <param name="args">Args</param>     [PostHandlerFor(formStr(EntAssetLifecycleStateUpdate), formMethodStr(EntAssetLifecycleStateUpdate, init))]     public static void EntAssetLifecycleStateUpdate_Post_init(XppPrePostArgs args)     {         SecurityRole                    role, systemAminRole;         SecurityUserRole                userRole, systemAdminUserRole;         FormRun                         sender = args.getThis();   ...

Nuget Update script

 .\nuget.exe push -Source "D365Build" -ApiKey az .\Microsoft.Dynamics.AX.Application1.DevALM.BuildXpp.nupkg .\nuget.exe push -Source "D365Build" -ApiKey az .\Microsoft.Dynamics.AX.Application2.DevALM.BuildXpp.nupkg .\nuget.exe push -Source "D365Build" -ApiKey az .\Microsoft.Dynamics.AX.ApplicationSuite.DevALM.BuildXpp.nupkg .\nuget.exe push -Source "D365Build" -ApiKey az .\Microsoft.Dynamics.AX.Platform.CompilerPackage.nupkg .\nuget.exe push -Source "D365Build -ApiKey az .\Microsoft.Dynamics.AX.Platform.DevALM.BuildXpp.nupkg ------------------------------------------------------------------------- Build solution script /p:BuildTasksDirectory="$(NugetsPath)\$(ToolsPackage)\DevAlm" /p:MetadataDirectory="$(MetadataPath)" /p:FrameworkDirectory="$(NuGetsPath)\$(ToolsPackage)" /p:ReferenceFolder="$(NuGetsPath)\$(PlatPackage)\ref\net40;$(NuGetsPath)\$(AppPackage1)\ref\net40;$(NuGetsPath)\$(AppPackage2)\ref\net40;$...

Power Automate vs. Logic Apps:

Image

Export All D365 F&O Custom Models with a Single Batch File

  Export All D365 F&O Custom Models with a Single Batch File April 09, 2025   In Microsoft Dynamics 365 Finance and Operations (D365 F&O), managing and exporting models can be a repetitive task, especially when you're dealing with a large number of custom models. To streamline this process, you can automate model exports using a simple batch file. In this blog, I’ll walk you through how to create a  .bat  file that exports all your custom models in one go—without needing to execute each command manually. This is especially helpful during regular backups or before code deployments. 🧠 Why Use a Batch File? A batch file allows you to: Export multiple models in one go Create backups with date-based folders automatically Reduce human error and save time Reuse and modify easily 📂 Folder Structure Assumption In this example, we're assuming the following: D365 metadata is located at  K:\AosService\PackagesLocalDirectory ModelUtil.exe is located in  K:\Aos...

Move the database from Dev to UAT or Tier1 to Tier2

Image
  Move the database from Dev to UAT or Tier1 to Tier2 Move the database from Dev to UAT or Tier1 to Tier2. Mostly, databases are moved from Tier 2 to Tier 1 environments. But in our case, most of the functional setup and configurations were completed in the Dev (Tier 1) environment, and the team needs this data to be moved to Sandbox (Tier 2).  Since transactional data is involved, we cannot use Data Entities. Therefore, we followed the process below: Step-by-Step Process to Move the Database from Dev (Tier 1) to UAT/Sandbox (Tier 2) 1. Export the AXDB from Dev (Tier 1) (.bak)          Export the AXDB database into a .bak file using one of the following methods:           Way1:  Right-click on the AXDB database and  Select Tasks > Back Up.         Way2:   Use the following SQL script to back up the database:     BACKUP DATABASE [AXDB] TO DISK = N'D:...

How to add Admin role to user from SQL in D365FO

Image
  How to add Admin role to user from SQL in D365FO In  SecurityRole  table we will find all roles. Execute the below statement to know the system admin role Recid. Select Recid,* from SecurityRole where NAME like 'sys%' Insert the data into  SECURITYUSERROLE   table with username and role recid. Execute the below statement. insert into SECURITYUSERROLE (USER_, SECURITYROLE,ASSIGNMENTSTATUS,ASSIGNMENTMODE) values('vinay', 235,1,1) If you want to update you can use the below statement. update SECURITYUSERROLE set SECURITYROLE = 235 where USER_ = 'Vinay' reference :-  Click here

Step-by-Step Guide to Restoring Production Database in D365 FO Development

Image
To have an up-to-date refresh DB in your Dev box or to debug some issues that are happening in the production only, keep reading my article. To refresh your Dev box Database, follow the below steps: Log in to LCS  https://lcs.dynamics.com/ Click on the project that you are working on. From the right of the screen, click on the  full details  of the  Test  environment that you will use to complete this process (you can't refresh  Development's  DB directly from production; we should refresh  Test  first). From the  Test  full details page, click on  Maintain , and choose the  Move database  option as shown below: Select  Refresh database  from  select the change type  list, then a new page will open to choose the source environment (select the production environment). Based on MS " Copying production data during business hours or peak hours could have an impact on the production system. It's highly ...