Posts

How to add subquery result in X++ FO D365

 If you want to add a subquery result in the lookup x++, Kindly follow the following steps; 1 - You have to create a temp table;   TableTmp tableTmp; 2- Add all records of TableA in the temp table as show below;        tableTmp.clear();             while select TableA              {                 tableTmp.RequestId = TableA .RequestId;                       tableTmp.doinsert();                   } 3- Remove the record you don't need in the tempTable, Which exists in TableB as shown below;     while select TableB             {                    select firstonly tableTmp where tableTmp.RequestId == TableB.RequestId;             ...

Populate Grid in X++

If you to populate the grid through code, You must create a temp table in the project. 1- For creating the temp table, filter any temp table in AOT like BOMCalcTransTmp  Table. 2- Duplicate the  BOMCalcTransTmp table in the project and change the name of the table and the fields of the table as you like. 3- Now add the temp table  BOMCalcTransTmp in the Datasource field of the grid. 4- Now the main part is how to populate the grid. You can populate the grid on the init() method or on the button clicked method as shown in the code below; 5- Kindly make the temp table  BOMCalcTransTmp table-type   InMemory . BOMCalcTransTmp bomCalcTransTmp;                 while Select bOMCalcTrans where bOMCalcTrans.CalcType == ItemCalcType::Process                 {                     bomCalcTransTmp.clear();            ...

Implement lookup through event handler

 If you want to write a lookup through the event handler. Follow the following code; [FormControlEventHandler(formControlStr(SalesTable, SalesLine_CostSheetId), FormControlEventType::Lookup)]     public static void SalesLine_CostSheetId_OnLookup(FormControl sender, FormControlEventArgs e)     {         Query                                   query;         QueryBuildDataSource                    qbdsFabCostSheetsCalculation;         QueryBuildRange                         queryBuildRange;         SysTableLookup                          sysTableLookup;         FormControlCancelableSuperEventArgs...

w3wp.exe process not showing d365

Image
 If you do not see the w3wp process in the attach to process menu in the Visual Studio. Follow the following steps: 1- Search Services by pressing the window + S button. The following window is open as shown below; 2-  Start the W3C Logging Service as shown in the above image. 3- Now restart Visual Studio and check your w3wp.exe Service is available. Thanks.

Create custom Batch job without parameters in D365 X++

 For creating the batch job without parameters in D365 X++ via SysOpertion Framework, Follow the following steps; 1- First Create a menu action button in the project 2-Create an extension of menu and add menu button to the Menu. 3- Create a ABCBatchContract Contract class as shown below; [DataContract,SysOperationContractProcessing(classStr(SysOperationAutomaticUIBuilder))] /// <summary> /// Create getter setter for query /// </summary> public class ABCBatchContract {      } 4- Create ABCBatchController Controller Class as shown below; /// <summary /// Inventory Blocking batch controller class /// </summary> public  class ABCBatchController extends SysOperationServiceController {     /// <summary>     /// Run the Service Opeeration class action     /// </summary>     protected void new()     {         super(classStr(ABCBatchService),methodStr(ABCBatchService...

Create custom workflow in D365 X++

Image
 For the creation of Custom Workflow in Dynamics 365 F&O, Kindly follow the following steps; 1. Create a custom Enum WorkflowStatus or you can use an existing one.   2. Create a new table EmployeeLeave as defined below and add the above Enum as a field and name it LeaveStatus . 3. Create a new form EmployeeLeaveForm by using the above table as a data source.   4. Create a new Display Menu Item EmployeeLeaveForm for the above form and add to any  Module by creating an extension of the Module Menu from the application Explorer. 5. Create a new Query EmployeeLeaveQuery  and add  EmployeeLeave as a data source.                 6. Create a new Workflow Category EmployeeLeaveCategory .   7. Create a new workflow type EmployeeLeaveWorkflowType .   • Category: Select the workflow category from the previous step • Query: Select the query created for the document table • Document menu item: Sel...

Convert amount from one currency to another currency using X++

  You can use the following X++ code snippet for currency amount conversion.     CurrencyExchangeHelper currencyExchangeHelper;     AmountMst amountMST;     CurrencyCode FromCurrency =  'PKR';     AmountCur amountCur = 5000;     currencyExchangeHelper = CurrencyExchangeHelper::newExchangeDate(Ledger::current(), systemDateGet());     amountMST =  currencyExchangeHelper.calculateCurrencyToCurrency(fromCurrency, SLDFabCostSheetsCalculation.Currency,amountCur,true);        info(strFmt("%1", amountMST));