Thursday, February 20, 2020

LCS error An error has occurred. Please try again later. If the issue persists, please contact support with this Id: 859f43e3

I recently opened LCS and got following error when I clicked one of my D365FO environments:
"An error has occurred. Please try again later. If the issue persists, please contact support with this Id: 859f43e3-9f0b-44e3-b415-803d3dff998d"




There's nothing to worry about. This issue is from Microsoft side, just try again after some time (like half an hour or an hour); the error will be gone by itself. In case there's some urgent deployment going on do raise a ticket with Microsoft.


Wednesday, February 19, 2020

D365FO Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))

While opening a table browser you may get this error sometimes saying,

"Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))"

Even if you build the model is doesn't work.

Solution:

1- Close Visual studio
2- Open your solution and build
3- Try opening again

Remember you can always directly open table browser from you browser through link. For example, you can open custtable with following link in you development environment.



in above link if you change name of custtable to any table it will open.

Thanks!

Wednesday, January 1, 2020

D365FO new custom module not showing

Problems Statement:

I had been able to create new modules by creating 'Menu' element, creating extension of 'MainMenu' menu and then referencing my custom menu there. I had deployed a new development VM with Product version Finance and Operations (10.0.5) and platform version 29, which was latest available till date (1st January 2020). I developed a new Menu the same way I used to do but it's not showing in Modules panel in left side. I built all the models and run db sync, still the problem exist.


Solution:

On my visual studio I set a display menuitem from that module as a startup project and ran with F5. It forced the module to show up.


References:
I asked this question on community when I faced the issue first.

https://community.dynamics.com/365/financeandoperations/f/dynamics-365-for-finance-and-operations-forum/376309/d365fo-new-custom-module-not-showing-in-update-29/998061#998061


Tuesday, December 31, 2019

D365FO new vertical/ product development

When you complete your brainstorming and designing of new vertical or product in Dynamics 365 for Finance and Operations, the next phase is development. You cannot directly jump on Visual Studio and start coding, there are many steps that you need to do, here are some of them:

  1. Create Azure DevOps project
    Azure DevOps is the new name of previously know TFS (Team Foundation Server). It's basically code repository service with advanced versioning features. I personally prefer Azure DevOps to GitHub, but for D365FO you cannot make your project on GitHub even if it's your favorite. You need to create a project for your product in Azure DevOps; It's free for upto 5 users.
  2. Specify VMs
    In D365FO, like other good renowned software, you need to have different VMs for different purposes. The most needed ones in initial phases are one development VM per developer, one code merge VM (build VM) and one test VM. You may also use your build VM for testing purposes.
  3. Build the Models
    Till this step you may already have a model diagram with you on paper, Microsoft Visio and any other tool. You may also look in this article of how I drew mine,
    https://microsoftdynamix.blogspot.com/2019/12/d365fo-new-vertical-product-architecture.html

    Model is technical classification of elements in your product. All the developments or extensions will be done inside these models.
  4. Start coding
    Now you can connect your Azure DevOps with your Development VM and start coding. Remember to go through Microsoft best practice documents in every blog they share, they help a lot in keeping the product up to date and in high performance.
Best of luck. Thank you!

Monday, December 30, 2019

D365FO new vertical/ product architecture

Hi,

It's common for ISVs to launch their products based on Dynamics 365 for Finance and Operations. Internally they call those products 'Verticals'. There are different stack holders indulged in this process from brainstorming of features till the testing and launching the product. In this blog, I will describe the process of designing the new product in technical perspective. We assume that brainstorming of the product has already been completed. The following steps are most important in this phase as I faced:

  1. Identify elements
    The first step after brainstorming is identifying as much elements as you. By elements I mean anything you can count as user, screen, process or even condition.
  2. UML diagram (Unit)
    Draw UML diagram of each user separately. Try to think as much deep as you can to cater corner cases. I believe that though brainstorming is done while deciding the features, it is a never ending process which shall keep going on till the final steps or even the product is launched to bring improvements in the product. Likewise, drawing drawing UML diagram for each user separately will make your mind think centrally in that perspective and identify processes in its perspective. The diagram below is an example.
  3. Complete UML diagram (Module diagram)
    Now connect those unit diagrams, it is a good idea to draw them on paper with pencil so you can rectify them easily. Module diagram will represent your product in business perspective. It will show the flow and dependency of objects on each other. The diagram below is an example.
  4. Model diagram
    Model is the technical classification of elements. Once every element is identified in Module diagram, you need to look how you can divide them with respect to development. In D365FO it is not good idea to put all your element in one cumbersome model. It is Microsoft best practice to make relevant models. The diagram below is an example.

Thank you!

Thursday, October 17, 2019

D365FO LCS The authentication process was not successful. Please contact your system administrator.

While connecting to create a repository The authentication process was not successful. 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.






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.

Monday, May 20, 2019

D365FO Platform update lcs GlobalUpdate script for service model: AOSService on machine: Dev

Hi,

I needed to update a Machine (Dev) from Application version 8 PU21 to PU24. The LCS gave the error on step 19 (from total 35).

lcs GlobalUpdate script for service model: AOSService on machine: Dev

I downloaded the log file, inside folder RunbookExecution-ExecuteParallelRunbook-** I got the log file of all steps. As in my case the error was on step 19 I directly checked the error log on step 19. It can differ in your case. I found multiple table errors in the file which stated:

Table Sync Failed for Table: *TheTableName. Exception: 
System.InvalidOperationException: Database execution failed: Violation of PRIMARY KEY constraint 'I_65518FIELD'. Cannot insert duplicate key in object 'dbo.SQLDICTIONARY'. The duplicate key value is (TableId, FieldId, 1, 0).

The error explains there already exist a field in the table with same field Id. Also the error took to explore SqlDictionary Table. The table contains all tables and their fields with their Id. There is another known table which stores such information and that is TableFieldIdTable.

I wrote following query to check if the fields in these table share consistent information:

First Query:

Select T.ID, T.NAME, T.TABLEID, S.FIELDID, S.Name,
(SELECT TOP 1 Q.NAME from SQLDICTIONARY Q WHERE Q.TABLEID = T.TABLEID AND Q.FIELDID = 0) AS TableName
from TABLEFIELDIDTABLE T
JOIN SQLDICTIONARY S ON T.TABLEID = S.TABLEID AND T.NAME = s.NAME
WHERE S.FIELDID <> 0 AND S.FIELDID <> T.ID
and T.TABLEID in (4451,14445,12235)
ORDER BY T.TABLEID

The above query returns all the fields which don't have same field Id on SqlDictionary and TableFieldIdTable. 4451,14445 and 12235 are the table Ids which I was getting error in log file. Yours may be different.

Hence, I needed to update the SQLDictionary table field Ids according with the field Ids in TableFieldIdTable. I wrote following queries:

Second Query:

Select S.FIELDID
from TABLEFIELDIDTABLE T
JOIN SQLDICTIONARY S ON T.TABLEID = S.TABLEID AND T.NAME = s.NAME
WHERE S.FIELDID <> 0 AND S.FIELDID <> T.ID
and T.TABLEID = 12235
and T.ID = 24

In the above query 12235 is table Id I was getting error. 24 is the field Id in TableFieldIdTable which I got from first query the blog. Second query is just for verification of field to exist. I needed to change the field Id value in SqlDictionary which was 19 then. So wrote following query to update SqlDictionary field Id to 24.

Third Query:

Update SQLDICTIONARY
set SQLDICTIONARY.FIELDID = 24
where SQLDICTIONARY.FIELDID = (
Select S.FIELDID
from TABLEFIELDIDTABLE T
JOIN SQLDICTIONARY S ON T.TABLEID = S.TABLEID AND T.NAME = s.NAME
WHERE S.FIELDID <> 0 AND S.FIELDID <> T.ID
and T.TABLEID = 12235
and T.ID = 24)
and SQLDICTIONARY.TABLEID = 12235

In the above query 12235 is table Id I was getting error. 24 is new field. The second query in blog is used as it is inside the third query (highlighted). I had to repeat the query carefully with the all faulty field Ids (there were 5 in total in my case). It can be different in your case.

Finally, I resumed the PU update process from LCS and it succeeded.


Thursday, May 16, 2019

D365FO Open local VM client from outside VM browser

To access D365FO local environment from outside is easy. All you need is to add local server IP and D365FO main page link to your host file.


  1. Open notepad as administrator
  2. Click open from file menu and navigate to 'C:\Windows\System32\drivers\etc'
  3. Select 'All files (*)'
  4. Opens hosts
  5. In the final line add your machine IP <space> usnconeboxax1aos.cloud.onebox.dynamics.com
  6. Save the file.

Now you can access the environment from outside VM from the machine where you have configured it.


Tuesday, April 23, 2019

D365FO table browser object reference not set to an instance of an object

Meanwhile your development you may face the error 'Object reference not set to an instance of an object' in Visual Studio while opening table browser. Follow the following steps to get rid of this error.

  1. Build the custom model with database synchronization checked.
  2. Reset IIS.
  3. Refresh AOT.
Several other blogs have suggested to do only step 1, which is not sufficient. Doing step 2 and 3 will definitely resolves the issue as it did in my case.   

Thursday, April 11, 2019

D365FO get workflow comment (submission, rejection, approval or any comment) X++

You can get workflow comment at any stage, be it from submission, approval, rejection or any other stage. There will be only one query for all of them with only change of an Enum WorkflowTrackingType value highlighed in the query below.

In this method , for example, the rejected comment of Purchase order workflow is fetched through query by filtering workflowTrackingTable.TrackingType with Rejection element of the enum.


private WorkflowComment getPORejectedWorkflowComment(PurchId _purchId)
{
        WorkflowTrackingTable           workflowTrackingTable;
        WorkflowTrackingStatusTable     workflowTrackingStatusTable;
        WorkflowTrackingCommentTable    workflowTrackingCommentTable;
        PurchTable                      purchTable;

        purchTable = PurchTable::find(_purchId);

        select ContextCompanyId, ContextTableId, ContextRecId from workflowTrackingStatusTable
        where workflowTrackingStatusTable.ContextCompanyId    == curext()
           && workflowTrackingStatusTable.ContextTableId      == purchTable.TableId
           && workflowTrackingStatusTable.ContextRecId        == purchTable.RecId
        join firstonly TrackingId, CreatedDateTime from workflowTrackingTable order by CreatedDateTime desc
            where workflowTrackingTable.WorkflowTrackingStatusTable == workflowTrackingStatusTable.RecId
                && workflowTrackingTable.TrackingType == WorkflowTrackingType::Rejection
        join Comment from workflowTrackingCommentTable
            where workflowTrackingCommentTable.WorkflowTrackingTable == workflowTrackingTable.RecId;

        return workflowTrackingCommentTable.Comment;
    }

The enum WorkflowTranckingType has following elements, specifying which you can get the specific comment:






Wednesday, April 10, 2019

D365FO turn off maintenance mode

You may face some problem like batch management service is not starting. It is because the maintenance mode is enabled. You have to run the following command on VM to disable maintenance mode. Run CMD as administrator and execute following command:

C:\AosService\PackagesLocalDirectory\Bin\Microsoft.Dynamics.AX.Deployment.Setup.exe --metadatadir C:\AosService\PackagesLocalDirectory --bindir C:\AosService\PackagesLocalDirectory\Bin --sqlserver . --sqldatabase axdb --sqluser axdbadmin --sqlpwd AOSWebSite@123 --setupmode maintenancemode --isinmaintenancemode false

In the previous command the AOS is installed in 'C' drive, the database administrator user is 'axdbadmin' and its password is the default password of axdbadmin 'AOSWebSite@123'.

Tuesday, April 9, 2019

Microsoft One Version, D365FO easy update

You need updated features of Microsoft D365FO for easy flow of your business processes. You may still be wavering whether to update your D365FO new version or not. This is very normal because you need see time, budget and relevant capability to do this; simply you can say,"The update is difficult." Thanks to Microsoft One Version which makes totally easy. The One Version is the update service that Microsoft itself runs on partners and customers environment. Microsoft does so to keep all environments consistent, up to date, seamless and error free. To feel not being forced to always update like we experienced on Windows 10, customers and partner can pause automatic update in this case; and even can control features in deployment.

The 'easy' term is used due to effortless update w.r.t customers. The partner/ customer receives notification for the update time scheduled on cloud environments and receives another when update is completed. The result log can be monitored in LCS. All the updated features will be available when update is done.

While it may look very fluent from outside, there are many process included to make this happen. They are as follows:

Regression Suite Automation Tool (RSAT):
It is a scripting tool. Specific to partner/customer organization environment the regression test script is run before update is processed on production.

Safe Deployment Rings (SDR):
The version and update process is taken step wise. Each update is first carried out internally on Microsoft environments, then to partner and finally on environments of customers. The process progresses to new step only when successfully completed. 

Release Validation Program (RVP):
For insuring successful general release which fits on every type of organization Microsoft uses RSAT suites provided by diverse partner/customer environments and run the regression script internally as part of SDR in addition to its own script.

Update time control:
Microsoft has given control to customer in case updates need to paused. You can find it Here on how it can be done.

Features control:
Customers can manage the features in their deployments. Deciding when the new feature shall be added and shall be adjustable to customer own business process.


The Microsoft One Version is undoubtedly an one of the biggest service related to updates. Making update a simpler and quite less threatening as it is managed by Microsoft through its many high quality processes and techniques. It relieves both the technical guy who carried out updates and customers by giving new feature control feature.


Thursday, April 4, 2019

D365FO get Vendor/Customer account from ledgerJournalTrans

You can get Vendor or Customer account from following ways:


1-  VendTable = VendTable::findByLedgerDimension(ledgerJournalTrans.LedgerDimension);

2- MainAccount MainAccount = MainAccount::findByLedgerDimension(LedgerDefaultAccountHelper::getDefaultAccountFromLedgerDimension(ledgerJournalTrans.LedgerDimension));

vendTable = VendTable::find(MainAccount.MainAccountId);

3- MainAccount MainAccount = LedgerDimensionFacade::getMainAccountFromLedgerDimension(ledgerJournalTrans.LedgerDimension);

vendTable = VendTable::find(MainAccount.MainAccountId);