Thursday, 21 February 2019

Get global parameter value in Query Based SSRS report in D365FO & AX2012

Recently I have got a requirement in which I have to add a new parameter in query based report, since I cannot change the query ranges so there is no option left except to use Global Parameter. I have simply add the parameter but unable to get the value of it. I have also search over the internet but couldn't find the solution, so after a little struggle with D365 I have able to solve this problem by writing only one line source code that returns my global parameter value and meet my requirement.

Note: In SSRS report global parameters are added directly into to the report by right-clicking on the Parameters node and choosing Add. Microsoft dynamics adds several parameters into each report in order to pass data required every report to execute. Parameters created with query range or from contract classes are pretty straight forward but the other set of parameters, the global ones, are more difficult to understand. You can learn more about parameters from this link.

Source Code:






//Get the parameter value
boolean parameterValue = this.parmReportContract().parmRdlContract().getParameter("Parameter Name in SSRS Report").getValueTyped();

That is all you need to write to get global parameter value.

Monday, 18 February 2019

Rearm Dynamics 365 Finance & Operations Virtual Machine

In this blog I will discuss how to Rearm Dynamics 365 Finance & Operations Virtual Machine for reactivating license which maintains the virtual machine. When you updated the license it will add 180 days of evaluation period. After 180 days are over, you can extend the evaluation period for the same number of days maximum three times.

Please follow step by step process:

Step: 1
Run command prompt as Administrator.

























Step: 2
Now run command Slmgr /dlv to track the remaining number of “rearm” in your virtual machine. In my case all three rearm counts are remaining.














Step: 3
Close the information box and run command Slmgr /rearm in order to rearm the windows. When you run the command system will ask for the restart of the machine.
















Step: 4
After you restart the virtual machine check again the status of the windows license it will now update the count of rearm.














That is it you need to do for Rearm Dynamics 365 Finance & Operations Virtual Machine.

Tuesday, 22 January 2019

Data entity not shown in Data Management in D365FO

Recently I have encounter a problem on which my custom data entity is not showing in Data Management. I have done almost everything to fix this problem but unable to fix this issue. 

In framework parameter I have refreshed the entity list also restart the data management server but data entity was not showing in the Data Entities List. I could not figure out what was the exact issue but I have manage to fix this problem by doing below mention steps. So I thought I should share this may be it could help someone. 

So lets get started.

Step 1:

Take backup of below mention tables:
  • DMFEntity
  • DMFTargetXML
  • DMFTargetXMLToEntityMap
  • DMFTargetEntityHierarchy
Note: Query for taking tables backup is shown in image.






Step 2:

Truncate above mention tables.







Step 3:

Now go to Data Management -> Framework Parameter -> Entity Settings and click Refresh Entity List.












By refreshing the entity list it will ensures all entities which are available in the environment and that the entities which have the latest metadata have to be updated in the data management. That is all you need to do to resolve this problem.

You can also refer this link: Data Management: Missing Entities

Monday, 21 January 2019

Resolve Error "Unable to recycle AppPool 'AOSService' running Site 'AOSService'. Check your IIS/Azure Environment for correct deployment" in D365FO

Recently in Dynamics 365 Finance and Operation I have got an error in which it says "Unable to recycle AppPool 'AOSService' running Site 'AOSService'. Check your IIS/Azure Environment for correct deployment". This error occurred while synchronizing the database. 








Reason of this error is because AOSService in Application Pool got stopped. 












Note:
Open IIS Manager and Run as Administrator.

























For resolving the issue, all you need to do is to run the AOSService in Application Pool.












Result:



Monday, 7 January 2019

Email invoices using different From addresses in D365FO

In Microsoft Dynamics 365 for Finance and Operation, we usually get a requirement to email invoices from some dedicated From email address (e.g. invoicing@mycompany.com). Unfortunately, emailing reports using different From email addresses is not enabled in D365FO out of the box. Each outgoing email with a printed report is always sent from the email of the current user, for example tabsheer@mycompany.com.

Furthermore, if we select SMTP as the email provider (you can select Email provider in System administration > Setup > Email > Email parameters) we will also need to configure our mail server (for example Exchange Online) to allow the account specified in SMTP settings in Email parameters to send emails in the name of any user who emails reports.

Thus, when emailing reports in Dynamics 365 for Finance and Operations two problems can arise related to the sender email address:
  • We cannot specify From email address on outgoing emails (current user’s email address is always used).
  • Additional configuration of the outgoing mail server, e.g. Exchange Online is needed.
I was wondering how we could set From email address on outgoing emails with minimum customization. In my previous article I discussed how to email invoices with the HTML email body and additional documents attached. I used a free tool call Docentric to achieve that and among other things, the same tool allowed me to specify From email address when emailing invoices.

Namely, Docentric enables you to enter an arbitrary From email address when emailing reports directly on the Print destination settings form. If you leave the From email address field on the Print destination settings form empty, the account specified in SMTP settings in Email parameters will be used.































How to Set Up Multiple From Addresses using Docentric:

In the Docentric AX Parameters form we can setup multiple From email addresses in the Additional From email accounts section and this way avoid creation of aliases on our Exchange Online for the account specified in SMPT settings in Email parameters.

Note: In my case I have provided two additional From email addresses.
Navigation: Organization administration -> Docentric AX -> Docentric AX Parameters -> Emailing (Tab)














Additional From email accounts
contains the following information:
  • User name: From email address (i.e. user account).
  • Password: Password of the user account.
  • Outgoing mail server: SMTP mail server we will use to send emails from D365FO (In my case I have provided Gmail mail server).

How to Use Multiple From Addresses Without Needing to Configure Exchange Server:

Docentric free-edition tool added a great value by enabling us to set up multiple SMTP accounts and/or outgoing mail servers directly in D365FO, and then use them to email SSRS reports or emails based on Email templates.

How this mechanism works? If we specify an email address in the From email address field in the Print destination settings form when emailing a report (e.g. Customer invoice), Docentric will try to locate this email address in Additional From email accounts first. If found, this account will be used. If not found, then the fallback to Default From email account will occur, which means that the account from SMTP settings in Email parameters will be used.

Note: For further detailed understanding, you can refer to this link.













After we finish with the setup, we need to set From email address in the Print destination settings form. For this example, I want to use "khan.tabshir@gmail.com" as From email address.
























Now simply generate the SSRS report. (In my case I used the Customer Invoice report).












Here in the below screenshot you can see that the outgoing email was sent from our custom Form email address (khan.tabshir@gmail.com).












On the other hand, if we leave the From email address field on the Print destination settings form empty, the resulting email will be sent from the email address specified in SMTP settings in Email parameters:











So far, I found many benefits of Docentric free-edition tool, especially for emailing reports. In this article, we saw how to set up different From email addresses when emailing invoices without the need to configure our mail server, and in my previous articles you can read how to set up the email body and additional email attachments, or how to monitor and resend failed emails with printed reports.

Monday, 31 December 2018

Import records from Excel using X++ code in D365FO

In this blog I will discuss how we can import records from Excel file in Dynamics 365 Finance and Operations.

Please see below screenshot with source code explanation:

Explanation of Source Code (1.1):
  • Add / Use following namespaces in the class. 


Explanation of Source Code (1.2):
  • Initialize and declare classes and data types.
  • Create a dialog object, which will open as form.
  • Add controls (Import, Upload and buttons).















Explanation of Source Code (1.3):
  • Get and load Excel file.
  • Get the row count for record iteration.
  • Iterate record and get the columns values on every iteration.















Result:
























That is all you need to do for creating a class which imports record from Excel.

Job to create default dimension having dimension attribute and value in D365FO

In this blog I will discuss how we create the default dimension having dimension attribute and dimension attribute values.

Please see below screenshot with source code explanation.

Explanation of source code (1.1):
  • In this section of Job Main method I have called the createDefaultDimension Method.
  • In this method I have passed three dimension attribute values.






Explanation of source code (1.2):
  • createDefaultDimension Method with three argurments.
  • Initialization and declaration of classes and data types.
  • Pass argument having dimension values and store into container.
  • After container is filled with dimension attributes and its values, iterate it.














Explanation of source code (1.3):
  • Iteration of dimension attributes.
  • Check dimension attribute exists or not.
  • Get the dimension attribute value.
  • Add the values of dimension in value Set Storage class by using add Item method.













Result:

Run the class (Job).












That is all you need to do to create default dimension record Id.

Create a Purchase Order from a Sales Order Using PurchCreateFromSalesOrder Framework in X++ | D365 F&O

In Dynamics 365 Finance & Operations, you may need to automatically create a Purchase Order from a Sales Order for scenarios such as int...