Skip to main content

Posts

Use temporary table as form datasource in D365FO

In this article, we will learn how we can use the temporary table as a form datasource in D365. In our scenario, we will populate the temporary table at runtime and bind it with the form datasource. firstly, we will pass an argument on the clicked event and write the form datasource  init  method to populate the data in it.  In our scenario we will work on the CustTable form, we will populate the customer group in the temporary table which we create on the selected customer while clicking the button. Step 1:  Create a new table of type TempDB and add two new fields i.e., CustGroupId and CustGroup. Step 2:  We will create a new form with the pattern (List Type), then add our previously created temporary table as a datasource, and then drag both the fields CustGroupId and CustGroup on the form grid part. After the form creation, we will also create the display menu item of type  form  and use our form on it. Step 3:  We will create an extension of t...

Inserting Data in Table using Query::insert_recordset

When dealing with performance, there is a query system control named Query::Insert_Recordset.  This allows multiple records to be inserted into a table in the same way the Insert_Recordset command works. This will also eliminate the  need to loop over hundreds of records, as well as roundtrips between the SQL server and the AOS server.  Here is a quick demo of how it works:  Query query = new Query(queryStr(MDTrvExpenseDetailsQuery)); QueryRun queryRun; QueryBuildDataSource qbdsTrvExpTrans, qbdsTrvExpTable, qbdsProjTable, qbdsHcmWorker, qbdsDirPerson; Map fieldMapping; HcmPositionWorkerAssignment hcmPositionWorkerAssignment; HcmPosition hcmPosition; MDTrvExpenseDetailsContract contract = this.parmDataContract() as MDTrvExpenseDetailsContract; paymentStatus...

Bank Cheque Report Customization

In this article, we will customize the Vendor Payment Journal   form and the Bank Cheque Payment  report in D365. We have to add the custom field in the Vendor Payment Journal form, report and also customize the slip text area of the cheque printing report. To fulfill the requirement we will follow such steps: Step 1: We will create an extension of the  LedgerJournalTrans  table and then add the custom field  Memo to it.  Step 2: We will create an extension of the  form   LedgerJournalTransVendPaym (Vendor Payment Journal)  and drag the  Memo  field in the lines from the LedgerJournalTrans datasource. Note: The custom field is successfully added to the form. Now we will add this field to the cheque report. Step 3: We will create COC of the  determineReportMenuOutput method of the ChequeController class to call our custom design of the cheque report.  [ExtensionOf(classStr(ChequeController))] internal final class ...

Adding custom field in the SSRS Report

The purpose of this blog:  We will add a custom field in the standard SSRS report We will create COC for the PSAProjInvoiceDP class to assign the custom field value First of all, we will go through the report: Project management and accounting -> Projects -> All projects Action pane -> Manage -> Project invoice proposal (as well as) Action pane -> Manage -> Invoice journal This is the default format of the report and we have to remove all the marked columns from our design and add the Service date  i.e., the Confirmed receipt date column in the first column of the line details as shown  below: The design of this report is: To fulfill the above requirement we will do the following steps: Step 1: We will create an extension of the table ' PSAProjInvoiceTmp ' . This table contains the information used in the line details section of the report. Here we add the new custom field named ' ReceiptDateConfirmed ': Step 2: We will duplicate the  ' PSAProjInv...

Add New Report Format to Print Management in D365

In my previous article , I explained how to add a custom field, make some  design  changes, and create a chain of command of the  PSAProjInvoiceDP  class in the PSAProjInvoice   report. In this article, we will look at how we can call our custom report that we have created in the previous article using Print Management. W hat is print management? Print management in D365 FO X++ is a powerful tool for managing and customizing your report designs. It provides a flexible way to control how your reports are printed and distributed. Adding our report design to print management By default, we have a PSAProjInvoice.Report   report format for the Project Invoice Proposal   and Invoice Journal  reports. In our case, we have to add our custom design using the Print management report format.  Project management and accounting -> Setup -> Forms -> Form setup Print Management -> Project invoice without billing rules -> To add a custom desi...

Insertion using RecordInsertList in D365

The RecordInsertList class facilitates array insertion functionality within the kernel. This feature enables the simultaneous insertion of multiple records into the database, thereby minimizing communication overhead between the application and the database. When iterating through a while loop, it's optional to insert each record individually and hit the database while inserting every single iteration. An alternative and efficient approach is to utilize RecordInsertList because It will minimize the number of hits to the database. It can speed up your performance of insertion. Here is an example of set based RecordInsertList class in which I am inserting data into my temp table: MDTableTmp mdTableTmp; CustTable custTable; CustGroup custGroup; RecordInsertList recordInsertListTmpTable; recordInsertListTmpTable = new RecordInsertList(tableNum(MDTableTmp), false, ...

Using Complex Ranges on Date Fields in Query

In some of the scenarios,  we want to filter out the from-date and to-date ranges on the basis of different fields and  we are not getting the outcome in which we want to apply the AND/OR clause between date ranges on different date fields and we cannot acquire this result using out-of-the-box query classes. So we have applied complex date ranges to get the desired outcome: void initQuery() { Query                          query; QueryRun                queryRun; QueryBuildDataSource      qbdsProjPeriodLine; QueryBuildRange rangePeriodId; query = queryRun.query(); qbdsProjPeriodLine = query.dataSourceTable(tableNum(ProjPeriodLine)); if (periodFrom && periodTo) { qbdsProjPeriodLine.addRange(fieldNum(ProjPeriodLine, PeriodFrom)).value(strFmt('((%1.%2 >= %4) && (%1.%3 <=...