Thursday, September 19, 2019

D365FO Failed to generate the user token for Dynamics Lifecycle services on behalf on user {*}. Please contact your system administrator.


While trying to connect to LCS for creating repository I got following errors:

Failed to generate the user token for Dynamics Lifecycle services on behalf on user {4E41*******38B}. Please contact your system administrator.


Even if try to add new repository it will give error, like in following screenshots.

                         

                        
                       

                       



You can solve it with following steps:



  1. Remove affected tokens
    The database may have affected key you need to take backup of data of this table and delete the records with following query.





  2. Add new repository
    Now you can add new repository without error

        

         

 it will take you to login page where you will give login Id and password, or will directly sign you in if you are already signed in.

         

Hope it solves your problem. You may comment your problem as well. I faced some other issues as well which I solved but forgot to take screenshots. Thanks.

Wednesday, September 11, 2019

Microsoft get LCS Project Id

To get your LCS project Id follow these steps:

  1. login to your LCS
  2. Click on your project
  3. Let the main main page of project open. You can now get the LCS project Id from the address bar (URL). It is usually 7 digit number.

Wednesday, August 21, 2019

D365FO Sync failed RouteOperationPropertiesResourceRequirementStaging duplicate record

While restoring data from a newer version 'Version 10 Update24 (7.0.5179.35389)' of AX to older version I faced the following error:

"
Table Sync Failed for Table: RouteOperationPropertiesResourceRequirementStaging. Exception: System.InvalidOperationException: Database execution failed: The CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name 'dbo.ROUTEOPERATIONPROPERTIESRESOURCEREQUIREMENTSTAGING' and the index name 'I_17244STAGINGIDX'. The duplicate key value is (5637144576, 6_Resource requirements for route operation properties, 6_Resource requirements for route operation properties-2019-08-20T12:21:09-B9A8188398E6401, 0).
"

Solution:

The error is due to the index allow duplicate property. In earlier version it didn't allow duplicate records in new version the problem is fixed and it does allow duplicate records. Because in my case I was taking data from newer version to older version I had to face this issue. Do following steps:

  1. On target VM (older version one), open SQL server and take backup of table 'RouteOperationPropertiesResourceRequirementStaging' data i.e. Generate script and in advanced property select Type of data script to 'Data only'.
  2. Delete truncate RouteOperationPropertiesResourceRequirementStaging table in target VM.
  3. On source VM (newer version one) go to 'AOSService > PackagesLocalDirectory > ApplicationSuite > Foundation > AxTables' and copy RouteOperationPropertiesResourceRequirementStaging. Paste and replace this element on target VM in same location.
  4. Build Application Suite and Application Foundation models and Synchronize database.
  5. After synchronization runs successfully copy and run the SQL insert query you took backup in step 1.

Comment if you need to need any help. Thanks.


Thursday, August 15, 2019

D365fo deploy reports through powershell

To deploy report use powershell following commands:


  1. All reports in all modules

    K:\AosService\PackagesLocalDirectory\Plugins\AxReportVmRoleStartupTask\DeployAllReportsToSSRS.ps1 -PackageInstallLocation "K:\AosService\PackagesLocalDirectory"

    Here the AOS resides in K drive.
  2. All reports in specific module

    K:\AosService\PackagesLocalDirectory\Plugins\AxReportVmRoleStartupTask\DeployAllReportsToSSRS.ps1 -PackageInstallLocation "K:\AosService\PackagesLocalDirectory" -Module ApplicationSuite

    Here all reports in Application Suite module will be deployed
  3. Specific report in specific module

    K:\AosService\PackagesLocalDirectory\Plugins\AxReportVmRoleStartupTask\DeployAllReportsToSSRS.ps1 -PackageInstallLocation "K:\AosService\PackagesLocalDirectory" -Module ApplicationSuite -ReportName MyCustomReport.Report

    Here MyCustomReport.Report inside the Application Suite module is deployed.

Wednesday, August 7, 2019

D365FO Database sync failed duplicate key on ProjHierarchySorting table

While taking my one server data to other, I faced the following error on Synchronization of database:




"Database execution failed: The CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name 'dbo.PROJHIERARCHYSORTING' and the index name 'I_19940NODEREFERENCE'. The duplicate key value is (5637144576, usmf, 0, , 0)."

I opened Sql server and found there were 22 records with many level columns having 0 value. I took backup of table data and deleted all the records with delete query.
Then I ran DB sync again from VS and it ran successfully.

Thursday, July 25, 2019

D365FO batch jobs not executing

"Batch job not executing", is one of the common problem we face in AX. Its solution is simple. Here are different reasons why batch job does not execute  and how to solve them:

  1. Batch job service
    The batch job service is not running. To check go to Services and check if the batch management is running. If it's stop, start it.
  2. Batch job is on Withhold state
    The batch job is paused (Withhold status). Go to batch jobs (System Administrator > Inquiries > Batch Jobs), find your batch job and make sure it's not in Withhold state.

    If it is withhold, from action pane click on Batch job > Functions > Change status. It will open a dialog.
    From the dialogue select waiting and click Ok. Now your job will wait for its turn to execute.
  3. Batch group server
    Make sure the batch group your batch job is attached to, is assigned to a batch server.
    Go to (System Administrator > Setups > Batch groups) click on your batch group and click the Server tab. Make sure a server is assigned to this.
  4. Number of batch jobs with less recurrence time
    If you have multiple batch jobs which have very less recurrence time. It will gradually increase the load and won't give enough time to bigger batch jobs to complete, resulting a pile of batch jobs waiting for a thread which can execute them. In this case try to withhold some of unnecessary batch jobs all allow other to get chance to execute.
  5. Database drive size
    Check if you have enough storage available on database drive. If you have saved your backups there move it to some other locations.

Wednesday, June 26, 2019

D365FO delete TFS workspaces (ghost workspace)

Hi,

It becomes headache one needs to change TFS account on Visual Studio. Following these steps may save your lots of time cleaning your previous workspace and configure new one. First try the lucky way if it didn't for you go for painful way.

Lucky way:

1- Close Visual Studio

2- Open Run (Win+R) and paste one by one the following and delete anything inside:
    %localappdata%\Microsoft\Team Foundation\6.0\Cache\
    %localappdata%\Microsoft\VisualStudio
    %localappdata%\Microsoft\VSCommon
3- Restart your VM

4- Open visual studio and configure with new account

Painful way:

1- Close Visual Studio

2- Open Run (Win+R) and paste one by one the following and delete anything inside:
    %localappdata%\Microsoft\Team Foundation\6.0\Cache\
    %localappdata%\Microsoft\VisualStudio
    %localappdata%\Microsoft\VSCommon
3- Open command and run following commands:
  • Goto IDE folder where the workspace program exist
    Cd C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE
  • Check all the current workspaces
    tf workspaces /server:https://dev.azure.com/{org} /computer:{ComputerName} /owner:* /format:detailed
  • If you see any ghost workspace delete it
    tf workspace /delete /server:https://https://dev.azure.com/{org} '{WorkspaceName};{UserName}

    if above command give error run it with user id instead of username
    tf workspace /delete /server:https://https://dev.azure.com/{org} '{WorkspaceName};{UserId}
  • Run this command to sure it's deleted
    tf workspaces /server:https://dev.azure.com/{org} /computer:{ComputerName} /owner:* /format:detailed

4- Restart your VM

5- Open visual studio and configure with new account


Comment if you stuck anywhere, I have wondering around this for 2 days, will try to help in anyway.