Posts

"Object reference not set to an instance of an object Error" When you do show all Fields

Image
Hi All , Just wanted to share a quick note about issue we faced once we upgraded to  Application version  7.2,  PU 12. If you visit any standard/customized form  where you added default dimension field wherein you specify  dimension entry control and you try to click show all fields from Options > record Info menu You get error "Object reference not set to an instance of an object."  The Reason behind  this error is , at run time in dimension entry Control class they re trying to create text control  using "dimensionEntryController" object without doing check if the object instance exist or not. KB 4051199 has been released to fix this issue, just get it from LCS and apply to your environments if you face these issue. 

Find References in dynamics 365 for operations using PowerShell

Image
Just wanted to share quick note about finding references from PowerShell . In dynamics 365 for operations you can use find references or cross references (Previous version AX 2012) from visual studio . Suppose you want to find In which objects a particular enum is used then in visual studio you can just click on that enum and click find references and it gives you list of objects where that particular Enum is used . With following PowerShell command along with object name you can see line of code where that particular enum is used with line number. To get the result perform following steps. First navigate to package folder so that you can refine your search. In my example I am using application suite and in my case pacakesLocalDirectory is at J drive . It can be in different drive as well. With updates 12 machines I can see its moved to K drive. cd J:\aosservice\PackagesLocalDirectory\ApplicationSuite And then use following command to search Get-ChildItem -Recurse -Filte

Customizing D365 with event handlers

With Dynamics 365 release we have to do most of the things using extensions and event handlers. You still have an option to over layer code. While creating new package if you choose select existing packages and modified any standard object which belongs to that package, you are doing overlaying.  In previous versions it was not a big  issue but with new release we should stop doing that and instead embrace a practice of doing customizations using extensions and event handlers. Source code and metadata of model elements can be extended without an over-layering using extensions. Today I will share some code snippets about how to  do few things while using event handlers How to get Form Datasource If you copy form event handler here is how you can get form datasource from XFormRun [FormEventHandler(formStr(HcmPosition), FormEventType::Initialized)] public static void HcmPosition_OnInitialized(xFormRun sender, FormEventArgs e) { FormDataSource hcmositio

Deploy Reports in Dynamics 365 for operations

Image
Hi Everyone, Wanted to share quick notes  about deploying SSRS reports in dynamics 365 for operations. Deploying all reports Using PowerShell All reports can be deployed using following commands . To run command open PowerShell as administrator  and run following commands Depending on path in your virtual machine you can switch between C and J drive J:\AosService\PackagesLocalDirectory\Plugins\AxReportVmRoleStartupTask\DeployAllReportsToSSRS.ps1 -PackageInstallLocation "J:\AosService\PackagesLocalDirectory" Deploying a specific Reports through PowerShell Now I want to deploy reports starting with AssetDep and TaxVatRegister , so I ran following command and in the output you can see only those reports get deployed. This trick is helpful in managed environment like UAT not prod when you have some issues with reports in those enviornments. J:\AosService\PackagesLocalDirectory\Plugins\AxReportVmRoleStartupTask\DeployAllReportsToSSRS.ps1 -Module ApplicationSuite -Repor

Integration With Dynamics 365 For operations using OData proxy generator.

Image
In This blog post we are going to look at how to expose and consume data entities in the new OData v4 endpoint in Dynamics 365 for Operations. We will mainly focus on three task ·       Customize/Use a data entity provided by Microsoft. ·       Register a new application in Azure Active Directory. ·       Implement an OData client to consume OData services, including creating a proxy library for the Microsoft AX OData endpoint. We are going to create simple Inventory movement journal as an example  Using out of the box available entities   InventoryMovementJournalHeader and InventoryMovementJournalEntry . Customize Microsoft provided data entity To make data entity available on Odata endpoint its isPublic property must be set to true. So for any standard entity you must change this property if it’s not already set to yes to make it available  on endpoint. When you create any new entity make sure you set isPublic = true so that its available on oDATA endpoint. In my scenario I a

D365FO Send Report as email attachment

Hi All , Usually in any implementation project we get request to send Report as a attachment in email.  Below is code going to help you to send  report as an email attachment.  In the below code I am saving report in report archive(DocuRef table ) reading it from DocuRef table  in to bytes and converting it in to memory stream. The memory stream is further I am going to use to  send an email with Subject and body using SysMailerMessageBuilder class. You can use following methods of this class setSubject - To set Subject of the email. setBody -  To Set email body . setFrom - To set sender of the email. sendInteractive - To send interactively. sendNonInteractive - TO send non interactively Args args; SalesInvoiceContract salesInvoiceContract; CustInvoiceJour custInvoiceJourLocal; SRSPrintDestinationSettings SRSPrintDestinationSettings; #SRSFramework

Running runnable class through URL in Dynamics 365 for Operations

Hi Everyone , There are multiple ways you can run Runnable class. One way is we can attach it to Menu item and add it to any form and execute it using menu item. Another way is set it up you project as startup object and runnable class as startup object in Visual Studio and run it from Visual studio. Another way of running it is from your browser (IE/Chrome). https:// URL> /?cmp= &mi=SysClassRunner&cls= Parameters: Cmp = Your company name e.g USMF Cls = Your Runnable class name e.g. ShowInvoicedOrderCount https://usnconeboxax1aos.cloud.onebox.dynamics.com/?cmp=USMF&mi=SysClassRunner&cls=ShowInvoicedOrderCount Whenever you want to quickly verify anything this way is very useful and you don’t have to spent time seeing while visual studio opens diagnostic tool and load other windows.