Hi everyone,
I am working on a customization in Microsoft Dynamics 365 Finance & Operations where I need to automatically create and post an Inventory Bill of Material (BOM) Journal based on records coming from a custom staging table.
I would appreciate guidance on the recommended X++ approach, especially for automatically triggering Report as finished and posting the journal.
1. Overall requirement
The process should work as follows:
TPGNM_StockTakeAdj (staging table) → Determine Journal Type → Create BOM Journal → Trigger Report as Finished → Populate RAF details → Post
2. Staging table – TPGNM_StockTakeAdj
The source data comes from the custom table:
TPGNM_StockTakeAdj
The fields required for journal creation are already available in this table and are similar to the fields currently being used for creating a Movement Journal.
The staging table contains the item/product variant, warehouse, quantity, reason code, etc.
The requirement is to use these records as the input for creating the BOM Journal.
3. Create the BOM Journal
This has been done through coding.
4. Trigger "Report as finished"
After the BOM journal is created, the next requirement is to automatically trigger:
Functions → Report as finished
This is the main area where I need guidance.
When manually using Report as finished, D365FO opens the Report as finished form.
The form is populated based on the selected product/item variant.
The required values are:
Product number / Item → From the staging record
Site → Default from the journal header
Quantity → From the staging table
BOM → Should automatically come from the active BOM
Explosion → Always enabled
Post now → Yes
After these values are populated, the requirement is to programmatically perform the equivalent of pressing the OK button.
This should automatically post the journal.
5. Expected automated process
The final automated process should therefore be:
TPGNM_StockTakeAdj
|
v
Create BOM Journal Header
| |
v
Create/Populate BOM Journal transaction
|
v
Trigger Report as Finished
|
v
Equivalent of clicking OK
|
v
BOM Journal posted
6. What I have already tried
I have tried BOMParmReportFinish.insert() method, but it is not populating in form level, but I am able to see data in SSMS.
I have already investigated the existing D365FO functionality and custom code around the BOM Journal process.
I also checked the standard BOM/Report as finished functionality and the related parameter/transaction tables.
I found that the Report as finished process involves BOMParmReportFinish
I am currently trying to determine the correct standard classes/methods to invoke rather than duplicating the standard Report as finished logic.
I also investigated InventDimId because the Report as finished parameters require inventory dimensions such as Site/Warehouse to be correctly initialized.
7. My main technical questions
Question 1 – Triggering Report as Finished
After creating the BOM Journal, what is the recommended way to programmatically trigger the equivalent of:
Functions → Report as finished
?
I would like to reuse the standard D365FO business logic instead of duplicating the logic from the form.
Question 2 – Automatically clicking OK / Post now
In the UI, the user selects:
Explosion = Yes
Post now = Yes
and presses OK.
What is the correct X++ method/class that represents this final processing step?
Class name: BOMReportFinish. closeOk()
Class name: BoMmultiReportFinish.checkCloseDialog()
I want the batch/custom process to perform the same business logic as the user pressing OK, rather than simply inserting records directly into the database.
8. Important requirement
I am looking for a solution that uses the standard D365FO framework/business logic as much as possible and all these should be achieved in single batch job process.
The desired implementation is:
Custom staging table → standard D365FO BOM Journal/Report as finished framework → standard posting
rather than:
Custom staging table → direct database manipulation
Thanks in advance.

Report
All responses (
Answers (