Tuesday, May 12, 2020

Get SQL name of Temp table Dynamics 365

Using code below in runnable class we can find temporary table name, which is created in SQL tempDB.


// Declare a TempDB table buffer
TmpCustName tCustName;
   
// Insert data to create the table in TempDB database in SQL
tCustName.AccountName = '10001';
tCustName.insert();
   
// Display the name

info(tCustName.getPhysicalTableName());


Dynamics 365 Trace parser does not work

While collecting and monitoring trace, we were getting error as below:

Error:
The ETW Providers  “Microsoft-AX-XPPExecutionTraces” and “Microsoft-Dynamics-AX-ExecutionTraces” aren't installed in the VM

Issue:
Below mentioned providers were not enabled.
Microsoft-Dynamics-AX-XppExecutionTraces : Used to capture X++ methods events.
Microsoft-Dynamics-AX-ExecutionTraces : Used to capture SQL events.

Solution:

Execute command below to enable both events.

$resourcefiledir = "C:\AOSService\webroot"
$inputmanfile = "C:\AOSService\webroot\Monitoring\DynamicsAXExecutionTraces.man"
$outputmanfile = "C:\AOSService\webroot\Monitoring\DynamicsAXExecutionTraces_copy.man"
$temp = Get-Content $inputmanfile
$temp = $temp -replace "%APPROOT%",$resourcefiledir
$temp | out-file $outputmanfile
wevtutil im $outputmanfile
$inputmanfile = "C:\AOSService\webroot\Monitoring\DynamicsAXXppExecutionTraces.man"
$outputmanfile = "C:\AOSService\webroot\Monitoring\DynamicsAXXppExecutionTraces_copy.man"
$temp = Get-Content $inputmanfile
$temp = $temp -replace "%APPROOT%",$resourcefiledir
$temp | out-file $outputmanfile
wevtutil im $outputmanfile

Friday, April 17, 2020

D365 FO you are not authorized to login with your current credentials.


Error:
You are not authorized to login with your current credentials. You will be redirected to the login page in a few seconds.

Reason:
Database restored into developer environment from another environment.

Solution:
Case 1:
If you have credentials of the user, who was the Admin in the environment from where database is restored - Use it!

Case 2:
If environment is locally hosted, we don't have credentials, we can use "Admin provisioning tool" to provision Admin user again. shortcut of this application is available in desktop otherwise you can find it from
Check K:\AosService\PackagesLocalDirectory\Bin


Case 3:
If the environment is Microsoft hosted, we will not be able to run “AdminUserProvisioning” tool and face error as below.

Here we have access of SQL database, so we can use query below to update Admin account.
Note: Value used in update query below, you can find from another database in your environment.   
UPDATE U
SET U.NETWORKALIAS = 'MThacker@abc.com',
    U.NETWORKDOMAIN = 'https://sts.windows.net/',
    U.SID = 'S-1-19-1410091826-xxxx-4079435192',
    IDENTITYPROVIDER = 'https://sts.windows.net/',
    OBJECTID = '25E55EE6-AB98-xxxxxxxx-FE00ACD05DBB'
--    Enable = 1
FROM UserInfo U WHERE U.Id LIKE 'Admin'

For case 3, after using query above, I was able to login to FO environment but still i am not sure this single query is enough?! 
Let me know, if you have any other experience with this! 



Monday, March 30, 2020

The working folder C:\Users\.. is already in use by the workspace MININT-F36S5EH;developer1@dynatechconsultancy.com on computer MININT-F36S5EH.

Error: The working folder C:\Users\.. is already in use by the workspace MININT-F36S5EH;developer1@dynatechconsultancy.com on computer MININT-F36S5EH.

Reason: we copied Virtual Machine and created new one. now we tried to map same workspace with different user. 
As server name and folder name is same TFS will not allow to map same folder on same server with different use (As it is logical that, on same server if another user wants to work, he/she needs to create another folder and map with that - TFS does not understand that we have copied VM so this is different server).

Solution: 
Option 1: (Rename developer server)
Rename server but as we know, as D365 FO developer it is not convenient and quick.if you want to go that way refer Microsoft blog - Link

Option 2: (Remove old account mapping)
I deleted my old account workspace by using command prompt.

Open CMD with admin rights, and navigate to C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE



prepare command as below.
tf workspace /delete "WORKSPACENAME;PREVIOUSUSERACCOUNT”

copy and paste in the command prompt and hit enter, then select "Y".
tf workspace /delete "MININT-F36S5EH;rahulax@xyz.com"

Monday, December 2, 2019

The command-line parameter -compressionminsize=1024 is invalid.

While starting AX client, you may face error as below.

Error "The command-line parameter -compressionminsize=1024 is invalid."


Reason & Solution

One of the reason for this error is, you are using AX server configuration file.

Create new client configuration file using "Client configuration" utility, which should work fine.

Also, let me know, if you find any other Reason/Solution for this error.

Monday, May 6, 2019

Duplicate records in Dynamics 365 Operations using X++


Example below can be used as sample code to find duplicate records from table using X++, either in AX 2012 or Dynamics 365 for finance and operations.

static void rdWrkCtrValidationDupRecords(Args _args)
{
    rdWrkCtrValidation  wrkCtrValidation;

    while select count(RecId) from wrkCtrValidation
        group by wrkCtrValidation.WrkCtrId
    {
        if(wrkCtrValidation.RecId >1)
        info(strFmt('%1 - %2',wrkCtrValidation.WrkCtrId, wrkCtrValidation.RecId));
    }

}

Query in SQL for similar requirement.

SELECT

    WRKCTRID,OUTPUT,COUNT(*)
FROM
    rdWrkCtrValidation
GROUP BY
    WRKCTRID,OUTPUT
HAVING
    COUNT(*) > 1
    



Tuesday, April 30, 2019

Address column Formatting in LogisticsPostalAddress table AX 2012


Issue/behavior

We have noticed that some of the records in table LogisticsPostalAddress column Address stores actually %1 instead of Country/Region.

If we review Address column using table browser, we might not able to notice this behavior due to PostLoad method on LogisticsPostalAddress table.

To review this, either comment method below in PostLoad method or review using SSMS.
DirUtility::replaceAddressToken(this);

What can be the issue due to this behavior?

1. When we are using this field for the integration, this will pass on %1 to other system.
2. To Print address on reports, if we are using bulk operation (Insert_Recordset) instead of row by row (while select) operation, it will show %1 on report/print.

Can we handle this behavior without code? - Yes

When we have selected Expand option in address format – DAX will store %1 instead of Country/Region in Address column of LogisticsPostalAddress address. 
BUT
If we have not selected Expand option in address format – DAX will store Country/Region Code instead of %1. i.e. CA instead of CANADA, so wherever we refer this field it will pass on CA instead of CANADA



Let me know, if you have any more inputs for the same.



Happening

Upgrade from AX 2012 to Latest Dynamics 365 Finance and Operation

Below are the steps defined by sequence. 1. Create new Upgrade project in Dynamics LCS. 2. Create VSTS Project and connect it with L...

Trending now