Posts

Year wise data for faster execution, in D365FO, using Views

Image
  You must have bumped across a situation in your implementation career, where you needed to class your data, based on year. As an example: It becomes very difficult to design such a structure, where individually you might need to write code for every customer, for each year: select sum(AmountMST) from custTable where custTable.TransDate >= fromDate && custTable.TransDate <= toDate; It will eventually result in extreme slowness of the process, which will make it go through each and every customer, over and over for all customers, for all the years. Definitely not a good solution. In all such cases, we can make a solution like this: a. Pre-calculating the year as 'Year-names' in a view, where we can store the years like 2021, 2022, 2023, (no hardcoding): Here 'YearName' is a computed column, which looks like this: private static server str compYearName()     {                  #define.PPCustTransYearNameView(PP...

Printing a logo in an excel file, using D365FO

Image
  Amigos,  Here is a small write-up that explains how to print a logo in an excel file, when you have created the Excel file through X++ code. The inherent problem with printing logo in an x++ generated files is: the logos stretch across several columns, and they are very hard to position to a particular location/cell, automatically. The following code, first gets the Logo image and then poses it at the start of the document, across first two cells.   Here are the steps: Before you begin, you need the following references: using System.Drawing; using OfficeOpenXml.Drawing; a. Get the image container: private container getCompanyImage()     {         CompanyInfo companyInfo     = CompanyInfo::find();         return CompanyImage::findByRecord(companyInfo).Image;     } Here for example, you are trying to print the company logo. b. Draw the logo and pose it across the first two columns of the file...

Using Maps(aka dictionaries) while interacting Python with X++

Image
  We all know the excellent capabilities of using a dictionary in Python.  A dictionary could be an indexed pair of key-value combinations, where we can have keys that necessarily not be a value that needs to start from zero.  Ex: assigning/defining a dictionary like this: custBal = {"CU0001": 250000.00, "CU0002": 65123.11, "CU0003": 43200.11, "CU0004": 10000.00} It contains customer balances. And thereby I can access the values like:  print(custBal["CU0002"]) We can also loop through the elements by: for x in custBal:     print (x) The compiler will give you Keys' values: Or I can access the values of the keys, by simply: print (custBal.values()) Which would result in: Also, I can add/remove/manipulate elements by simple operations like: del (custBal["CU0002"]) Now to the main point. Why so much ado about dictionary` data-types on Python? Answer is simple. They behave exactly as a map datatype of x++. We can, in essence, ...

D365FO: batches and workflows not working after database restored in VM

Image
Tired and worried of your batches malfunctioning/not working, after you have restored your database in your local VM? In case if you have faced this issue, just thought of sharing with you – this could save a good amount of your time. Going to your System admin à setup à Batch group, in case if you are unable to see this tab: This tab is very much essential, as this makes you assign servers to your batch group. Skipping this tab, will essentially make your batch groups left unassigned to any batch server. A little inspection in the form’s INIT method said: Which means if the ‘Batch priority based scheduling’ is enabled à then this tab won’t be shown. Go to features à and see this features is enabled:   Turn it off and come back to your Sys admin page à batch group à reload the page. This tab will be shown now:     Once you have selected the server, your batches should resume now.  Now whoa, whoa, whoa -- your ba...

Creating LedgerDimension from DefaultDimension in D365F&O

Image
  Its a very common requirement to create ledgerDimension, based on DefaultDimension. Generally we have a habit of hardcoding the dimension names, to get the resulting ledgerDimension value: ex -- dimensionMap.insert('CostCenter', '0033501_036'); dimensionMap.insert('Location', '2023GBG'); Where CostCenter, Location, Purpose, etc. are various financial dimensions. But wouldn't it have been great, if we could generalize the code, so as to eliminate dimension names hardcodes, so that if tomorrow the client decides to include more dimensions, edit or remove some of them, we don't have to change our code? This article can give you a very handy code to do the same. All you need to do is to call it correctly 😊 I have created a class separately: DimDimensionHelper. The following method has been added: public static Map getDimensionWiseDimensionValues_DefaultDimension(DimensionDefault _dimensionDefault)     {         Map dimMap = new Map(Type...

Managing creation of ZIP files for data packages for D365F&O, using Azure functions

Image
Background Managing data operations using Data Packages is one of the very common execution strategies for any D365F&O implementation.  A data package for a finance and operations app can consist of one or many data entities. A typical data package consists of  a group of entities for a specific task, process, or function . For example, the data entities that are required for general ledger setup might be part of one data package. Importing data that are required for customer creation (e.g. customer group, payment terms, payment methods, reason codes, customers) could be another data package. It’s a very common requirement to make the data packages be exchanged as a part of integration. We could have an external system that a.        drops files on a shared FTP site b.        drops files on a blob storage c.        sends mailers containing file content d.    ...