Friday, August 4, 2023

Code to Populate Custom field data from PurchTable to PurchParmtable in D365 X++

    [ExtensionOf(classStr(PurchFormletterParmData))]

   internal final class DaxPurchFormLetterParmData_Extension

   {

       protected VendDocumentTableMap initializeParmTable(

      VendDocumentTableMap  _parmTable,

      PurchLine             _purchLine,

      PurchTable            _purchTable,

      TradeLineRefId        _tableRefId,

      boolean               _hold,

      boolean               _notApproved ,

      Num                   _purchSummaryFormLetterId,

      VendPostingProfile    _postingProfile ,

      InventProfileType_RU  _inventProfileType

     )

       {

           VendDocumentTableMap map = next initializeParmTable(_parmTable,

                                                         _purchLine,

                                                         _purchTable,

                                                          _tableRefId,

                                                          _hold,

                                                          _notApproved ,

                                                          _purchSummaryFormLetterId,

                                                          _postingProfile ,

                                                         _inventProfileType);

 

           PurchParmTable  purchParmTable  = _parmTable;

           purchParmTable.UserName = _purchTable.UserName;

           return map;

       }

   }

........

Output :




Other Way :

    [ExtensionOf(classstr(PurchFormLetter))]

   internal final class Dax_formLetterParmData_Extension

   {

       public void chooseLines(boolean _processAdditional,

                          VendDocumentTableMap _parmTable,

                          boolean _append)

       {

           PurchParmTable purchParmTable;

           PurchTable purchTable;

 

           next chooseLines(_processAdditional , _parmTable,_append );

 

           select forupdate purchParmTable where purchParmTable.RecId == this.parmLastParmTableRecId();

           purchTable = purchTable::find(purchParmTable.PurchId);

           ttsbegin;

           purchParmTable.DaxStatus = purchTable.DaxStatus;

           purchParmTable.update();

           ttscommit;

       }

   }






No comments:

Post a Comment