I need to send logs to AppInsight for batch job execution details. I tried to add my custom code in insert method of BatchJobHistoyTable, but it's never get executed. Because records created though set based operation. ProcessedFinishedJobs method in BatchProcessFinishJobs class creating records in BatchJobHistory table and this class is internal, all method in this class are private. Please help me where I can add my custom code so that when batch job execution is completed , I can send those details to AppInsight.
Note that history is not logged in all cases. For example, no history is logged if the job succeeded and its LogLevel isn't set to Always.
If you're interested only in situations when history was logged, simply skip your logic if no history is available.
If you want to log information about all batches, even if they don't write anything to history, using the BatchHistory and BatchJobHistory tables doesn't meet your actual requirements.
If you want to know what exactly happens in your case, debug code in BatchRun::serverProcessFinishedJobs().
Hi Martin,
Thanks for your replies and suggestions.
processFinishedJobsSendAlertsDelegate method of BatchRun class , always has null value for BatchHistory and BatchJobHistory buffer. I need this table buffer with values.
I think you should focus on BatchRun class.
For example, what about subscribing to processFinishedJobsSendAlertsDelegate? It's what the system itself does to send alerts.
Moved to Dynamics 365 Finance Forum. The category changed to Development / Customization / SDK.
Hi Martin,
Yes it's about Dynamics 365 F&O and the application version is 10.0.30
Platform release - PU54 (7.0.6592.89). It would be helpful if you move this thread to respective forum.
Thank you !!
If it's about Dynamics AX, please tell us which version you're using. If it's about F&O, let me move this thread to the right forum.
André Arnaud de Cal...
292,074
Super User 2025 Season 1
Martin Dráb
230,900
Most Valuable Professional
nmaenpaa
101,156