Posts

Working with muliple label files -- an easy hack to save lotta time

Image
  Yeah, this happens when you are working with multiple label files. If you are working with a client that has multiple languages, then obviously you have to create the same label, across all these files, for each language, each time you are creating a new Label. You have to open the UI again and again for each language and repeat the same operation: Tiresome, ain't they? Here is an easy hack for that. Create the label once using UI, and then replicate them across all languages: Create all the labels you want to add, by opening UI from any label/language file. Try to keep them alphabetically named, as D365FO stores them in Alphabetical sequences. Save and close the file. Right click on the label file and select 'Open with XML editor': This shows all the Labels created for this label file.  Find/search for the labels that you created. Ideally, all your newly created files would be clubbed up at one place, if you have named them alphebetically. Copy them and paste them to all...

Updating Default dimensions -- the best possible way

Image
  Ever come across a situation, where you needed to update the default financial dimensions, runtime? Suppose you have sales lines, and they dimensions like [Costcenter-purpose-department-Employee]. There is a requirement, that asks you to update: depending on certain situations, the dimension code on 'Purpose' needs to be changed. This sorta requirement is quite common, and I bet you have confronted several situations like this, before. Even a few versions of D365FO this, was damn easy. There was this function, which can let you change twitch between any Fin. dimension values:  ledgerDimensionDefaultFacade::serviceReplaceAttributeValue(SalesLine.DefaultDimension, InventTable.DefaultDimension, DimensionAttribute::findByName("ProdLine").RecId); But this method has changed and it looks like the following: dimension = LedgerDimensionDefaultFacade::serviceReplaceAttributeValue(                         _defaultDimension, ...

WHMS validations: where can I put my code

Image
  Ever come across a situation where you needed to induce validations, in Warehouse Management mobile apps, before letting the user finally submit data?  For example: you need to check if the supplied value for the target license plate, while shipping a transfer order, must be exactly 12 characters long. Or the supplied date of a warehouse Load must be more than or equal to 5 days from today. Or imagine there is a flag in your warehouse, called Stopped for all transactions and while doing GRN from your mobile app, you need to see if it's a stopped warehouse. For all such situations, there is a trusted class (dedicated exclusively for WHMS) called:  WhsControl and you need to wisely put your code there. Essentially WhsControl is a class that has all the variables stacked up in it: the associated WMSLocationId, InventLocationId or ItemId or even the calling menu item. You can simply do a CoC on " processControlUsingDisplay " method, so as to perform these validations and r...

Reduce the number of fields in your table design as low as possible: boost your performance using UnitOfWork framework

Image
  As a best practice issue, you might have seen this BP deviation warning: The number of fields in <SO_&_So_Table> is more than 18. Consider breaking down the fields into smaller number of fields . This is a standard BP check, that emphasizes to keep the number of fields in a table as low as possible. Factually, keeping the number of fields more than the breakeven of 18 is just not a BP issue, but could lead to various CRUD operations as well as a lot of unforeseen performance impacts (although in standard, you could see a lot many OOB tables that have violated this fact and have over 30+ fields. Standard has safely marked these tables with Cache lookup as: NOTINTTS -- although that might not be a good solution, always). I prefer the following arrangement: The parent table could be kept with a bare minimum number of fields' set, while all the necessary children tables could be mined with the differential number of fields. And make the children-to-parent table relation by ...

Speed up your execution performance by using SysGlobalCaches

Image
  Ever come across a situation where you needed to  a. Using a multi-threaded batch to import a journal header and lines, from a staging table. The table already contains the Journal Ids which you need to assign to the header and allocate the lines under that header. b. You need to continuously check after each line being imported, if the journal with the Id has been created. If not, it will create the header and create the lines under it;  If yes, it will directly create the lines for the header (Find or create). c. As you could rightly guess, this architecture has an inherent sluggishness associated with it -- each time you keep on checking if the header has been created or not, it does mean a lot of performance effects, as a consequence. Also as you can understand it's a multithreaded code, which means each thread has no direct relation with the other -- which does mean there is no way I can talk between the threads/pass on any information. SysGlobalCaches to...

Automate sales order payments through x++ code

Image
  We all are aware of  'Complete' sales order functionality: which essentially completes a sales order by making differential payments, added to line. It submits the command by sending out a nudge to payment lines (CustPaymTable [if any]), by checking out the changes/added/removed from sales inventory/work added and then either closes the transaction by either authorizing the transaction or by failing it by declining the same: Suppose, you have a situation, where you need to automate this, by reading from some staging table, and then doing the needful to complete the payment. The following code explains the process:  MCROrderRecapStatus recapStatus =   MCREndOrder::orderRecap(_salesTable,                                                                         mcrSalesOrderTotals); Here...

Working with delivery remainders: a word of caution

Image
  While updating the delivery remainder through code, you must be aware of the following code, which is widely available in the Google market:  SalesUpdateRemain::construct().updateDeliverRemainder(salesLine2update,                                                                                         qty2Delv,                                                                                         qty2Delv); However, this won't help you, if you are working for a Call-center based client/retail clients/royalty clients . Retail clients have a fac...