Posts

Open form via its AOT name in D365 Finance & operations

Image
  For developers, it can come handy if they can directly open the form via its AOT name in D365 finance & operations rather than opening via its menu item. To do so, you can simply search in the search bar by typing   form:<form AOT name> For example, users management form AOT name is PurchTable . When it is searched, all its references in ERP will be provided as search suggestion.

How to do string left or right padding in X++

This article will explain how you can do string padding with zeros or space with the specified length either left padded or right padded in X++. Often we have a requirement that the desired string should be of specific length (say 10) and if it is not of that length, it should be prefixed with 0. A practical example would be that we need to export bank or vendor txt file with the specific configuration at desired places for a string with a specific length from ERP. To do left padding,  strRFix   function can be used and to do right padding,  strLFix   function can used Syntax str strRFix(str _str,int _length,char _char= ‘ ‘) str strLFix(str _str,int _length,char _char= ‘ ‘) str value = 'Demo' ; //strRFix Info(strRFix(value, 7 , '0' )); // this will info '000Demo' Info(strRFix(value, 7 )); // this will info '   Demo' // 3 parameter is optional with default value of space   //strLFix Info(strLFix(value, 7 , '0' )); //this will info 

Conversion of amounts from one currency to another currency in D365

This article describes how can we convert amounts from one currency to another. ExchangeRateHelper ::curPrice2CurPrice(Price, FromCurrencyCode, ToCurrencyCode, ExchangeRateDate);

Create movement journal through X++ code in D365FO(Import code)

class DAL_MovementJournal {       public static void main( Args _args)     {

Send Auto-Email when purchase order posting a product receipt

Image
Today i am going to show you code how to send an auto-email  through x++ code  when the purchase order posting a product receipt   class DAL_PurchFormLetterClass_EventHandler {     /// <summary>     ///     /// </summary>     /// <param name="args"></param>     [ PostHandlerFor ( classStr ( PurchFormLetter ), methodStr ( PurchFormLetter , run))]     public static void PurchFormLetter_Post_run( XppPrePostArgs args)     {         PurchFormLetter PurchFormLetter      =      args.getThis() as PurchFormLetter ;         VendPackingSlipJour      vendPackingSlipJour;          PurchTable   PurchTable = PurchFormLetter.purchTable();          if (PurchFormLetter.documentStatus() == DocumentStatus ::PackingSlip               && !PurchFormLetter.proforma())         {             vendPackingSlipJour = PurchFormLetter.parmJournalRecord();              this. sendMail_ProductReceipt(vendPackingSlipJour);         }    

Send Auto-Email when sales order posting a packing slip

Image
Today i am going to show you code how to send an auto-email  through x++ code  when the sales order posting a packing slip  class DAL_SalesFormLetterClass_EventHandler {       [ PostHandlerFor ( classStr ( SalesFormLetter ), methodStr ( SalesFormLetter , run))]     public static void SalesFormLetter_Post_run( XppPrePostArgs args)     {       SalesFormLetter   SalesFormLetter = args.getThis() as SalesFormLetter ;       if (SalesFormLetter.documentStatus() == DocumentStatus ::PackingSlip          ||   SalesFormLetter.documentStatus() == DocumentStatus ::ProjectPackingSlip           &&  !SalesFormLetter.proforma()   )         {             custPackingSlipJour      custPackingSlipJour = SalesFormLetter.parmJournalRecord();                 if (custPackingSlipJour)                this. sendMail_Sales_PackingSlip(custPackingSlipJour);         }      } public void sendMail_Sales_PackingSlip( CustPackingSlipJour _CustPackingSLipJour)     {         Set