Friday, August 21, 2026

Docentric version update process

Docentric official link: How to Upgrade Docentric AX Models - Docentric AX

Docentric website to Download Models: Download Center

 In my process i have updated the version from 3.5.1.4 to 3.5.1.6

Note : Docentric update works only when the D365FO version is 10.0.44 and above. You can also see the update more details in the Read me text after unzipping the models downloaded.

Before Update :



After Update :



Steps to upgrade:

1.       Connect to a development environment in which you want to upgrade the Docentric version.

2.       Open a browser and Go to the Download Center and download the latest version of Docentric.

3.       Download 3 zip files

a.       Docentric AX Framework

b.       Docentric AX SSRS Replicas (Model with all replicas)

c.        Docentric AX CBD Replicas (Model with all replicas)

4.       Place them in C:Temp and extract all zip files. (Contains 6 model files with extension. axmodel)

5.        Open PowerShell as an administrator and paste in the below script to stop the services. Script pasted below he lighted in color(Blue).

6.       Open up Visual Studio as an administrator.

7.       Check to see if there are any pending changes.

a.        If there are not any pending changes, proceed with the next step.

b.       If there are pending changes, exclude the changes.

8.       Go to 'Source control explorer -> Trunk -> 10-Dev -> Metadata -> Locate the model we want to delete -> right click and Delete model'. // your dev branch

a.       Note: Ignore any error messages as source control should still reflect the model being deleted.

9.       Delete other models which are related to Docentric.

10.    Navigate to pending changes, and check-in the pending deletion of the model adding a meaningful comment.

11.     Right Click 10-Dev(your dev branch) and do get latest version. 

 

12.    Close Visual Studio.

13.     Open the File Explorer and navigate to 'K:\AosService\PackagesLocalDirectory'.

14.    Within the 'PackagesLocalDirectory', navigate to the model folder we are updating and delete the entire folder. Delete the docentric related folders.

a.        If conflict occurs, make sure Visual Studio is closed, open services, and stop Microsoft Dynamics 365 Unified Operations: Batch Management Service

15.     Open PowerShell as an administrator and paste in the below script to start the services. Script pasted below highlighted in color


16.    Open an administrator command prompt and run the following import command for all 6 models. Examples are attached in the file below. Script pasted below highlighted in color(red).

This one is for clear understanding of file path -- below

a.  "K:\AosService\PackagesLocalDirectory\bin\ModelUtil.exe" -import -metadatastorepath="K:\AosService\PackagesLocalDirectory" -file=[File path to downloaded model file]

 

17.  Copy the below scripts red color.

18.    Check to see if there are any pending changes.

a.       If there are not any pending changes, proceed with the next step.

b.       If there are pending changes, exclude the changes.

19.     Go to Source control explorer navigate to 'Trunk -> 10-Dev -> Metadata' //your dev branch

20.    Right click the Metadata folder then 'Add items to folder' and select the specific model's folder.


After clicking on above path, select your Docentric folder 1st folder and click on next.

a.       DO NOT select 'XppMetadata'

b.       Do this before running the compile.

c.        Go to the excluded items tab and include everything in that tab.

d.       Filter the included items by 'Size descending -> Select all empty Delta folders' and exclude them.

21.    Click 'Finish'

22.    Repeat step 20 and 21 for all 6 models.(Related to docentricc models)

23.    After importing the model files, 'Click Extensions -> Dynamics 365 -> Model Management -> Refresh Models' to refresh the models. Then run a build of the model by going to 'Extensions -> Dynamics 365 -> Build Models' and select the model we imported.

24.    After the model builds, go to 'Extensions -> Dynamics 365 -> Synchronize Database' and run a sync.

25.     Once the sync has completed, check-in the new model to source control with a meaningful comment.

26.    After checking it in, run a build of the Dev pipeline from Azure DevOps. If the build succeeds, the model has been successfully installed. 

27.    Merge the 2 changesets (Deleted changeset generated at step 10 and changeset generated at step 25) and create a package.

28.    Apply the package to Tier 2 environments.

Below are commands which are used in the process :

1st cmd (Copy the blue colour)

<#

.SYNOPSIS

    Stops all D365 services

.DESCRIPTION

    Stops all D365 services that could potentially lock local files.

#>

using namespace System.Security.Principal


[CmdletBinding()]

param ()


# Shutdown commands to pass to subconsole

$CommandList = @(

    'Write-Host -ForegroundColor Cyan ''[*] Stopping services...''',

    'iisreset.exe -Stop',

    'Stop-Process -Name batch.exe -ErrorAction SilentlyContinue',

    'Stop-Process -Name "iis*" -ErrorAction SilentlyContinue',

    'Stop-Service -Name "IISADMIN" -ErrorAction SilentlyContinue',

    'Stop-Service -Name "DynamicsAxBatch" -ErrorAction SilentlyContinue',

    'Stop-Service -Name "*Dynamics.AX.Framework.Tools.DMF*" -ErrorAction SilentlyContinue',

    'Stop-Service -Name "LCSDiagnosticClientService" -ErrorAction SilentlyContinue',

    'Stop-Service -Name "MR2012ProcessService" -ErrorAction SilentlyContinue',

    'Stop-Service -Name "MSSQLFDLauncher" -ErrorAction SilentlyContinue',

    'Stop-Service -Name "ReportServer" -ErrorAction SilentlyContinue',

    'Stop-Service -Name "MsDtsServer130" -ErrorAction SilentlyContinue',

    'Stop-Service -Name "MSSQLServerOLAPService" -ErrorAction SilentlyContinue',

    'Stop-Service -Name "SSISTELEMETRY130" -ErrorAction SilentlyContinue',

    'Stop-Service -Name "SSASTELEMETRY" -ErrorAction SilentlyContinue',

    'Stop-Service -Name "SQLTELEMETRY" -ErrorAction SilentlyContinue'

)


# Subconsole process arguments

$ProcessArgs = @{

    ArgumentList = [string]::Join("`n", $CommandList)

    FilePath = (Get-Command "powershell.exe").Source

    Wait = $true

}


$User = [WindowsPrincipal]::new([WindowsIdentity]::GetCurrent())


# Customize arguments based on admin status

if (-not $User.IsInRole([WindowsBuiltInRole]::Administrator)) {

    $ProcessArgs["Verb"] = "RunAs"

    Write-Host "[*] Launching elevated subconsole..." -ForegroundColor Cyan

}

else {

    $ProcessArgs["NoNewWindow"] = $true

}


# Launch the elevated subconsole

Start-Process @ProcessArgs


# Customize exit message based on subconsole return code

if ($?) {

    Write-Host -ForegroundColor Cyan "[*] All services were successfully shutdown"

}

else {

    [Console]::Error.WriteLine("[x] Failed to shutdown all services")

}


point 15------------------------------------------------------------------------------------------------

<#

.SYNOPSIS

    Starts all D365 services

.DESCRIPTION

    Starts all D365 services that could potentially lock local files.

#>

using namespace System.Security.Principal


[CmdletBinding()]

param ()


# Startup commands to pass to subconsole

$CommandList = @(

    'Write-Host -ForegroundColor Cyan ''[*] Starting services...''',

    'Start-Service -Name "MSSQLFDLauncher" -ErrorAction SilentlyContinue',

    'Start-Service -Name "ReportServer" -ErrorAction SilentlyContinue',

    'Start-Service -Name "MsDtsServer130" -ErrorAction SilentlyContinue',

    'Start-Service -Name "MSSQLSERVER" -ErrorAction SilentlyContinue',

    'Start-Service -Name "MSSQLServerOLAPService" -ErrorAction SilentlyContinue',

    'Start-Service -Name "SSISTELEMETRY130" -ErrorAction SilentlyContinue',

    'Start-Service -Name "SSASTELEMETRY" -ErrorAction SilentlyContinue',

    'Start-Service -Name "SQLTELEMETRY" -ErrorAction SilentlyContinue',

    'Start-Service -Name "DynamicsAxBatch" -ErrorAction SilentlyContinue',

    'Start-Service -Name "*Dynamics.AX.Framework.Tools.DMF*" -ErrorAction SilentlyContinue',

    'Start-Service -Name "LCSDiagnosticClientService" -ErrorAction SilentlyContinue',

    'Start-Service -Name "MR2012ProcessService" -ErrorAction SilentlyContinue',

    'Start-Service -Name "IISADMIN" -ErrorAction SilentlyContinue',

    'iisreset.exe -Start'

)


# Subconsole process arguments

$ProcessArgs = @{

    ArgumentList = [string]::Join("`n", $CommandList)

    FilePath = (Get-Command "powershell.exe").Source

    Wait = $true

}


$User = [WindowsPrincipal]::new([WindowsIdentity]::GetCurrent())


# Customize arguments based on admin status

if (-not $User.IsInRole([WindowsBuiltInRole]::Administrator)) {

    $ProcessArgs["Verb"] = "RunAs"

    Write-Host "[*] Launching elevated subconsole..." -ForegroundColor Cyan

}

else {

    $ProcessArgs["NoNewWindow"] = $true

}


# Launch the elevated subconsole

Start-Process @ProcessArgs


# Customize exit message based on subconsole return code

if ($?) {

    Write-Host -ForegroundColor Cyan "[*] All services were successfully started"

}

else {

    [Console]::Error.WriteLine("[x] Failed to start all service")

}

16------------------------------------------------------------------------------------------- //Below commands are to create folders in local dev machine


"K:\AosService\PackagesLocalDirectory\bin\ModelUtil.exe" -import -metadatastorepath="K:\AosService\PackagesLocalDirectory" -file="C:\Temp\DocentricAX_3.5.1.6\DocentricAX\Docentric AX.axmodel"


"K:\AosService\PackagesLocalDirectory\bin\ModelUtil.exe" -import -metadatastorepath="K:\AosService\PackagesLocalDirectory" -file="C:\Temp\DocentricAX_3.5.1.6\DocentricAX\Docentric AX Extension.axmodel"


"K:\AosService\PackagesLocalDirectory\bin\ModelUtil.exe" -import -metadatastorepath="K:\AosService\PackagesLocalDirectory" -file="C:\Temp\DocentricAX_3.5.1.6\DocentricAX\Docentric AX Emails.axmodel"


"K:\AosService\PackagesLocalDirectory\bin\ModelUtil.exe" -import -metadatastorepath="K:\AosService\PackagesLocalDirectory" -file="C:\Temp\DocentricAX_3.5.1.6\DocentricAX\Docentric AX Warehouse Labels.axmodel"


"K:\AosService\PackagesLocalDirectory\bin\ModelUtil.exe" -import -metadatastorepath="K:\AosService\PackagesLocalDirectory" -file="C:\Temp\Model - Docentric AX SSRS Replicas 3.5.1.6\Model - Docentric AX SSRS Replicas\Docentric AX SSRS Replicas.axmodel"


"K:\AosService\PackagesLocalDirectory\bin\ModelUtil.exe" -import -metadatastorepath="K:\AosService\PackagesLocalDirectory" -file="C:\Temp\Model - Docentric AX CBD Replicas 3.5.1.6\Model - Docentric AX CBD Replicas\Docentric AX CBD Replicas.axmodel"



Tuesday, August 18, 2026

X++ Code to pick the Batch error logs in D365F&O

 My requirement is to pick the error logs for particular batch jobs.





Click on the view tasks to check the execution log details. I need to get the below error details in custom form.


Code :

This code picks the latest executed batch record. you can apply conditions based on the requirement.

BatchJobHistory    batchJobHistory;

   select batchJobHistory
       order by batchJobHistory.RecId desc
       where batchJobHistory.BatchJobId == "5638569578";          
   
   if(batchJobHistory.Status == BatchStatus::Error)
   {                    

       BatchHistory            batchHistory;
       BatchJobHistory         batchJobHistoryloc;
       SysInfologEnumerator    enumerator;

       while select RecId, Info, Caption from batchHistory where 
           batchHistory.BatchJobHistoryId == batchJobHistory.RecId
           && batchHistory.Status == BatchStatus::Error
       {
           str                             ret;
           enumerator = SysInfologEnumerator::newData(batchHistory.Info);

           while (enumerator.moveNext())
           {
               if (enumerator.currentException() == Exception::Error)
               {
                   ret += enumerator.currentMessage() + '\n';
               }
           }
            errorBatchJobTable.Log              =   ret; // holds the error.
        }
}

Output :



Note : BatchJobHistory::showlog() method brings the full log for the history. See the message details.






Create and Manage LCS access for new users

 Create an LCS Project

1. Open lcs.dynamics.com in your web browser.
2. Log in with your credentials. (If you do not have credentials, you will either need to create an account or work with your administrator. If you are a Global admin in Office 365 then you can go to office.portal.com and log in, Click Admin to go to the Admin center, then click Admin > Dynamics 365 for Operations. This will take you over to LCS with your credentials that you logged into Office 365 with.)
3. On the LCS home page click the Add icon in the Recent projects area.

4. On the Create a project pane, type a unique name for your project in the Name field. For example if this project will be used for a Demo environment you might type "Demo". If you are a customer and you want a separate project for Developers, for example, you might type "Development".
5. Type a detail description in the Description field.
6. In the Product name field, select Microsoft Dynamics 365 for Operations.
7. In the Industry field, select an appropriate industry or if one of the options does not apply to your organization, select Other.
8. Click Create.


Add a Project User to the LCS Project
The next step in the process is to add users to your project. Users are required for anyone that needs access to manage or monitor your environment. If you are using the Business process library or other features, a user would need access to be able to manage and upload documents, modify the methodology and so on. 
 
1. Open lcs.dynamics.com in your web browser.
2. Log in with your credentials.
3. Select the LCS project you want to add a user to from the list.
4. Click the Hamburger menu button. (That really is the real name for that funny little button with three horizontal lines - the more you know!)
5. Select Project users from the list.

6. On the Project user management page, click the Add icon to create a new user.
7. In the Email field you can do one of two things:
      a. If the user you are adding is part of your organization (a user in your Office 365 tenancy or AAD tenancy) then you can use the User lookup field to find the user.
      b. If the user is not part of your organization, or you just want to type an email address, then enter that email address into the Email field.
8. In the Project role field, select the role you want to assign to the user.
9. Click Invite.