Monday, April 6, 2020

Delete D365FO model

While cleaning up a development environment, we often use command ModelUtil.Exe to delete Model file of package, but it happen that the package is still shown on packagesLocalDirectory folder.

After performing the command ModelUtil.Exe to delete Model file of package, also follow the steps below to clean up package completely in many cases:

1- Stop IIS.(Aos machine)

2- Stop DynamicsAXBatch service on Task manager

3- Delete your package completely located on K:\AosService\packagesLocalDirectory

4-Open VS

5- Dynamics 365 --> Model management --> Refresh models

6. Restart WWW service, SQL Service IIS Service

Wednesday, March 18, 2020

D365FO - Reassign TFS workspace

Common error:

The path K:\AOSService\PackagesLocalDirectory is already mapped in workspace...

or

The working folder K:\AOSService\PackagesLocalDirectory is already in used by workspace..

Assume that you are using VS2015 for D365FO development. All the activities below to be performed in the DEV machine where you have issues with TFS workspace. Signout and close Visual Studio.

Step 1: Download and Install Team Foundation Sidekicks 2015
(http://www.attrice.info/cm/tfs/)

Step 2: From Windows Start, Open 'Developer command prompt for VS2015'

Step 3: Change directory to 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE'

Step 4: Reset user data from command prompt with the command "devenv /resetuserdata"

Step 5: Have a VSTS admin account to login to VS and then connect to VSTS project. Provide the credentials information as prompted.

Step 6: Now, sign out and exit from VS.

Step 7: Open the  'Team Foundation Sidekicks 2015' apps. Provide the Team foundation server name and VSTS admin credentials.

Step 7: Go to Tools > Workspace sidekick. Filter the local VM name and user name with a date range to view the existing workspace mapping information.

Step 8: Upon found, delete working folder map and delete workspace name.

Step 9: Close the apps.

Step 10: Now open the VS with the credentials for the new user who will be using the Development environment. Connect to VSTS project and perform mapping to local package folder to VSTS.

Saturday, July 27, 2019

Dynamics 365 for Finance and Operation - Model Management

Open "Windows PowerShell ISE"

Change directory to Bin folder under metadata path for D365 FO (K:\AosService\PackageLocalDirectory\bin)

Export Model:

ModelUtil.exe -export -metadatastorepath=[path of the metadata store] -modelname=[name of the model to export] -outputpath=[path of the folder where the model file should be saved]
.\ModelUtil.exe -export -metadatastorepath=K:\AosService\PackagesLocalDirectory -modelname="MYModelName" -outputpath=C:\Temp


Import Model:

ModelUtil.exe -import -metadatastorepath=[path of the metadata store where model should be imported] -file=[full path of the file to import]
.\ModelUtil.exe -import -metadatastorepath=K:\AosService\PackagesLocalDirectory -file="C:\Temp\MyModelName-Model publisher name.axmodel"


Delete Model:

ModelUtil.exe -delete -metadatastorepath=[path of the metadata store] -modelname=[name of the model to delete]
.\ModelUtil.exe -delete -metadatastorepath=K:\AosService\PackagesLocalDirectory -modelname="MYModelName"

Wednesday, May 17, 2017

D365 for Operation - Adding users from other O365 tenant

In the previous post, D365 for operation – Adding users from the single O365 tenant, we have seen how to create user and setup the same in D365 for operation environment.

In this post, we will setup any valid O365 users in D365 for operation environment. Our organization exchange server is hosted online using Office 365 subscription. I can access to the O365 portal by using my organization email id. 

In the next step, I will setup a user and assign my organization email id in the trial demo version of D365 for the operation which is hosted locally on my computer.
For demo purpose, I consider my organization email id is “myname@someorganization.com”

  •          Go to D365 for operation VM and browse URL to open environment.
  •           Enter a valid credential to log in.
  •           Go to system administration module and open the User form.
  •           Add a new user
  •           Assign a unique user id
  •           Assign the email id as myname@someorganization.com
  •           Setup Provider as  https://sts.windows.net/someorganization.com
  •           Assign other details such as Default Company and roles.
  •           Logout and login back to the environment using myname@someorganization.com

Dynamics 365 for Operation - Adding users from single O365 tenant


Dynamics 365 for Operation can be accessed either in cloud hosted environment such as Azure or by downloading a VM locally.  The users in in D365 for operation can be Office 365 subscription users or can be imported from an on premise active directory (AD) which requires active directory integration to azure.

While building up a trial environment for D365 for operation using LCS, it set up and uses Office 365 for authentication. Office 365 subscription uses a default domain such as <company name>.onmicrosoft.com for identity management which is indeed managed by Azure Active Directory (AD).

Azure AD is the supporting directory service used by Office 365 to provide access to services. An Azure AD tenant is attached to a single Office 365 tenant.

Although you can use Azure AD to create and manage user and group accounts, it's a good idea to you use the Office 365 admin center. For example, even if you can add users in the Azure management portal, you still need to add licenses in the Office 365 admin center. 

In my case, I have setup a trial D365 for operation environment using LCS and downloaded the VM file to set up locally in my computer using VMWare. During setup, I have created a unique organization as DXCT and set user id as as “opradmin”. On completion, my first O365 login id is created as opradmin@dxct.onmicrosoft.com . I can now browse the O365 portal using this id which is automatically set as “Global administrator” role in the O365 trial subscription for the organization DXCT.

Next, in D365 for operation VM, we need to provision O365 user id as admin user id using the shortcut ‘AdminUserProvisioning’ in the desktop. Open the tool in administrator mode and enter this O365 user id which will set opradmin@dxct.onmicrosoft.com as email id for the admin user id in the D365 for operation environment. The default provider is set as https://sts.windows.net/ . If you browse this site, it will take you to the O365 portal.

In case, you would like to add more users in D365 for operation environment from the same organization,
  •       Go the O365 portal using the login id which has role “Global administrator”
  •          Add user in the organization dxct.onmicrosoft.com
  •          Go to D365 for operation environment and add a new users manually
  •          Assign user id, set email id as newly created O365 user id, assign default company, assign one or more roles.
  •          Logout and login to D365 for operation portal with the new user id

Creating a new user in O365 portal

New user is added in the O365 portal

Add a new user in D365 portal and assign the email as created above in O365 portal

Login with new user

Dashboard for new user


Tuesday, May 9, 2017

Directory integration for Office 365 and Azure under different tenant

Recently, I was performing a migration from AX 2012 CU 11 to D365 for operation. I have a valid azure subscription from Visual Studio Ultimate with MSDN. The AAD tenant administrator is based on Microsoft Hotmail id.

For a D365 for operation partner trial, I have signed up using the link below which creates an O365 account to access Lifecycle services (LCS).


To be noted, the tenant administrator for azure and tenant for LCS are two AAD instance. At this point, there is no directory integration between them.

MSDN
A tenant can be defined as a client or organization that owns and manages a specific instance of that cloud service. With the identity platform provided by Microsoft Azure, a tenant is simply a dedicated instance of Azure Active Directory (Azure AD) that your organization receives and owns when it signs up for a Microsoft cloud service such as Azure or Office 365.

Each Azure AD directory is distinct and separate from other Azure AD directories. This means that users and administrators of one Azure AD directory cannot accidentally or maliciously access data in another directory.

As a part of the migration process for hosting environments in the cloud, we need some perform authorization and later add an azure connector.

First, the azure tenant administrator that owns the azure subscription must grant access to “Dynamics 365 for Operations” applications on the tenant. To do this, go to the project setting page under Azure connector tab we need to click authorize the LCS Deployment Service (DSU) to work on the Azure subscription as below screens shot.


















But, this authorization may not take place successfully as we have two different azure subscriptions, one for Microsoft Hotmail account used for azure cloud and other for an O365 account used for D365 for operation in LCS. Therefore, we need to manage the directory that was created for an Office 365 subscription in Azure using the below link


After this, we will assign the Contributor role to the 
  • Dynamics Deployment Services [wsfed-enabled] application
  • An O365 account used in LCS.

In the azure portal, select your subscription,  browse to Access control (IAM). Select Roles and highlight Contributor and Add.
















Now, you click on the authorize link which will take you to a login page to key in credentials using your Hotmail id.

MSDN
“The Azure Resource Manager (ARM) is the service used to provision resources in your Azure subscription.

Secondly, we need to add an azure connector to the LCS project. In the project setting page under Azure connector tab, click add and enter the azure subscription id. Enable “Yes” to Configure to use Azure Resource Manager (ARM).

Enter Azure subscription AAD Tenant Domain (or ID) which is domain name of azure such as “xxxxxxhotmail.onmicrosoft.com”

Click next for validation.















































Afterward, you will find that ARM is enabled for the Azure connectors as follows.




Friday, July 3, 2015

POS Number Sequence Details : RetailPOSSeedData (Table) : Dynamics AX 2012 R3 CU8

Retail POS seed data table is used to hold number sequence details for stores. For example:

DataType
DataValue
StoreNumber
TerminalId
DataArea
Transaction ID
140
BOSTON
Boston_01
USRT
Shift ID
12
BOSTON
Boston_01
USRT
Receipt sale
10
BOSTON
Boston_01
USRT
Receipt return
12
BOSTON
Boston_01
USRT
Receipt default
11
BOSTON
Boston_01
USRT
Receipt sales order
13
BOSTON
Boston_01
USRT
Receipt sales invoice
13
BOSTON
Boston_01
USRT
Receipt payment
2
BOSTON
Boston_01
USRT
Retail log id
2
BOSTON
Boston_01
USRT

Fields-
·         DataType refers the type of the transaction takes place at POS system.
·         DataValue refers the current number of transaction takes place.
·         StoreNumber is the identifier for channel.
·         TerrminalID is the identifier for a register (POS) under the channel.

In the POS side, there is an equivalent table named as “ax.RETAILPOSSEEDDATA”. For any activity in POS such as login, logout, sales, receipt etc. POS uses this table to get the data value specific to data type (transaction type). If no record is found based on a datatype, a record is created with incremented datavalue and update the datavalue to reserve the next number for a datatype. If record is found it just increment and update the datavalue. The store procedure “[crt].[GETNEXTNUMBERSEQUENCEVALUE]”  in the store database is responsible for this activity.


This store procedure also returns the current numbers to be used for the fields TransactionID, ReceiptID
 in the table “ax.RETAILTRANSACTIONTABLE”. The P-job sends the data periodically from this table to back office (AX) in the equivalent table “RetailTransactionTable”

 In order to view the current seed data, Go to Retail>Periodic>Retail POS Redeployment form.

 
In order to calculate the POS number sequence details for a register, create a new record and select the store and register.  Click the button “Calculate POS number sequence”. This will call a static method in the RetailPOSSeedData to calculate the current used numbers for different data type.
You may edit this numbers using “Edit POS number seq..” and set new numbers and push the data back to POS. Use the scheduler job 1160 (POS redeployment) to perform this.  Based on this, a new number sequence will be generated in the POS. But, if the “ax.RETAILTRANSACTIONTABLE” has already a records with same number POS transaction will not take palce successfully due to duplicate key error as follows:

Violatio  of PRIMARY KEY constrain. Cannot insert duplicate key in object ‘ax.RETAILTRANSACTIONTABLE’.




To void such error, try to setup the CDX components so that the transaction at POS sync to AX. Use the above form to calculate POS number sequence and push this data using 1160 job back to POS. Once the data is updated to POS, it will start creating transaction based on next number.

Monday, February 9, 2015

In Ax 2012 EP "You cannot view data on this page because you are not a registered user in Microsoft Dynamics AX.Contact your Microsoft Dynamics AX administrator."

In Ax 2012 EP 

"You cannot view data on this page because you are not a registered user in Microsoft Dynamics AX.Contact your Microsoft Dynamics AX administrator."

My resolution:
- Import .net bc in all partition in dynamics ax with system user permission
- Set .net bc in all partition in dynamics ax in system service account
- Go to "System administration \ Set up \ Enterprise portal \ Web site". Check the site url is correct: http:///sites/DynamicsAx.  

Thursday, November 27, 2014

Multiple report design association in Dynamics AX 2012 SSRS using X++

It is obvious that we customize many document reports e.g. Sales order, Purchase order, Quotation, Projects for a new report design and call the report from different journal accordingly. There are few ways to specify the new report design, using Print management document or setting this new report design as a system report in the table "PrintMgmtReportFormat".

In most of the cases, AX SSRS report controller class call for the system report from PrintMgmtReportFormat table using the following method:


PrintMgmtReportFormat::findSystem(this.getPrintMgmtDocumentType()).Name);


The controller class has a method  "runPrintMgmt" which is responsible for defaulting the system report. In this method, the class object FormLetterReport does the actual job for calling and assigning system report with printer setting.

formLetterReport.loadPrintSettings(custQuotationJour, custQuotationJour.salesQuotationTable(), this.quoteLanguageId());

So here my code goes. I write a method and call this after the above line of code in the controller class. This custom method basically initializes the PrintMgmtPrintSettingDetail object and conditionally, I am passing my custom report design. In this way, it overrides the print setting with my new report design.

void customPrintSettings()
{
    PrintMgmtDocInstanceType        type;
    PrintMgmtPrintSettingDetail     printSettingDetail      = new    
    PrintMgmtPrintSettingDetail();
    SRSPrintDestinationSettings     defaultSettings         = 
    formLetterReport.parmReportRun().parmDefaultOriginalPrintJobSettings();
    PrintMgmtReportFormatName       reportFormatName        = 
    ssrsReportStr(PSAQuotations, CustomReportSG); //Passing custom report design

    if (formLetterReport.parmPrintType() == PrintCopyOriginal::Original)

    {
        type =  PrintMgmtDocInstanceType::Original;
    }

    if (formLetterReport.parmPrintType() == PrintCopyOriginal::Copy)

    {
        type =  PrintMgmtDocInstanceType::Copy;
    }

    printSettingDetail.parmReportFormatName(reportFormatName);


    printSettingDetail.parmType(type);


    printSettingDetail.parmInstanceName(enum2str(type));


    // Since this will be reported to the screen, one copy is the only thing that makes sense

    printSettingDetail.parmNumberOfCopies(1);

    printSettingDetail.parmPrintJobSettings(defaultSettings);


    if (!formLetterReport.parmUseUserDefinedDestinations())

    {
        printSettingDetail.parmPrintJobSettings().printMediumType(
        SRSPrintMediumType::Screen);
    }

    formLetterReport.parmReportRun().loadSettingDetail(printSettingDetail);

}

Cheers !!!