Posts

Working with Model/Extensions (Part 2) - D365

Image
Use objects of other models in our custom model and solve reference error. In this part we will solve the common issue usually faced at the beginner stage while development in D365.  Let's say we need to search for the attachment in a sales order. We will find it through job using x++ query. Create a job ( Runnable class ) We need to use DocuRef table in our query to search for the attachments of the sales order.  Now, when we build the project it will show the error shown below in the image. Following error " does not denote a class. . . " usually occurs when the model of the project does not refer to the model of the objects using in it.  DocuRef table belongs to the other model i.e. Application Foundation. Which is not included in our custom model AXGuru_Customizations. We need to update our model which we have previously discussed the steps in  Part 1 . For ease, I am showing steps here too. Go to...

Working with Model/Extensions (Part 1) - D365

Image
Create extension of the objects related to other models in our custom model in D365 When we create a new model in D365, the model refers to the only package ApplicationPlatform by default which means we can only create extensions of the objects related to the ApplicationPlatform model. System will not allow to work with the objects related to other models with our model AXGuru_Customizations. For example: We can create extension in our model to customize the objects of Application Platform model. But if we need to customize an object related to other models like Application suite,  the system does not allow us to create extension of the objects by disabling the option. This is because system will only allow to work with the packages referenced with our model AXGuru_Customizations. So, In this case we need to add Application suite reference to our model. Go to tab Dynamics365> Model Management > update model paramaters... Select the model ...

Upload file to Azure blob - D365

Image
Upload file to Azure blob  - D365 In this blog we will upload file to Azure blob using Dynamics 365. File path can be different according to the scenarios. In my case I have attached a file to a sales order. Following are the steps mentioned below. Step 1:   Add an attachment to the sales order.  File has been attached to the sales order. Step 2: Code to upload the attached file to the azure blob storage. Firstly, we need to have credentials of the azure storage. On the Azure portal we can find the credentials on the following navigation.  Home > Resource groups > select resource group > storage account > select storage account Under Settings  section, click on Access keys to get the credentials of storage account. Note:  We can upload file to azure blob using connection string or using key and storage account name. Code is same for both with some differences. Upload file ...

Positive pay file in D365

Image
Positive Pay File -  D365  Convert XSLT file to CSV format. Positive pay files are created using data entities. The input file format must be only of XML type. Therefore, we need to create an a file with the extension XSLT ( Extensible Style sheet Language Transformation ). Create an XSLT file. Note: We can use Notepad/Notepad++ and save it with extension .XSLT  Now, we need to do setup configurations to run positive pay file on bank. Step 1: Add positive pay formats. Go to Cash and bank management > Setup > Positive pay formats   Create/edit positive pay file format. Then click on Upload file used for transformation to upload XSLT file created above. Step 2: Assign file format to the bank. Go to  Cash and bank management > Bank accounts > Bank accounts. Select any bank. Go to  Manage Payments Tab > General > positive pay format. Select payment format. Now, before jumping to step ...

Cross Company queries - X++

Image
When we create a query in X++, it fetches record only for the company that we are logged in. If we want to get records for multiple companies, we have the keyword in X++. i.e. crossCompany. Select query: For example, Let’s say we write the following query. SalesTable            salesTable; while select * from salesTable {     i nfo(strfmt(“%1”,salesTable.SalesId)); } It will return only the records from the company we are logged into. Now we want to get records from all companies. We will need to write following query. while select crossCompany salesTable {     info(strfmt(“%1”,salesTable.SalesId)); } This crossCompany keyword will return all the companies record. If we want to get specific companies records, we need to use container . For example, container specificComp = [‘USMF’,’USMR’]; while select crossCompany : specificComp salesTable {     info...

Debug SSRS report in AX 2012

To debug classes, methods, tables and forms in AX, we simply mark the breakpoint on the code or write the keyword breakpoint . But when it’s come to SSRS report it needs few step to debug it, mentioned below 1) In DP class of the report, change SrsReportDataProviderBase to SrsReportDataProviderPreProcess in class declaration. 2) Change Temporary table property to Regular . 3) Change Temporary table property Created By to Yes 4) Change Temporary table property Transaction Id to Yes 5) Add the following line also in process report method of DP class tmpTable.setConnection(this.parmUserConnection()) Mark break point in the code and run the report. It will hit the break point now.

Get product variant in AX 2012 (X++)

Image
Get product variant in AX 2012 (X++)  Product variants are setup for product master to distinguish between the same product with respect to size, colors etc. For example, Bi-Cycle is the product master and its size and color can be different which are its variant. Product variant can be seen from: Product information management > Common > Released product Select any item and click on Released product variants. These variants can be fetched using following code through X++. Using Query Build Datasource: Query query =            new Query(); QueryBuildDataSource     qbds, qbdsDim; QueryRun                qr; InventDim                 InventDim; ItemId                   itemId  =  "10001" ; qbds = query.addDataSource( tableNum (InventD...