Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

unable to send batch job execution history while record insertion in BatchJobHistory table

(0) ShareShare
ReportReport
Posted on by 20

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.

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,900 Most Valuable Professional on at
    RE: unable to send batch job execution history while record insertion in BatchJobHistory table

    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().

  • Arti bharane Profile Picture
    Arti bharane 20 on at
    RE: unable to send batch job execution history while record insertion in BatchJobHistory table

    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.

  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 230,900 Most Valuable Professional on at
    RE: unable to send batch job execution history while record insertion in BatchJobHistory table

    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.

  • Martin Dráb Profile Picture
    Martin Dráb 230,900 Most Valuable Professional on at
    RE: unable to send batch job execution history while record insertion in BatchJobHistory table

    Moved to Dynamics 365 Finance Forum. The category changed to Development / Customization / SDK.

  • Arti bharane Profile Picture
    Arti bharane 20 on at
    RE: unable to send batch job execution history while record insertion in BatchJobHistory table

    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 !!

  • Martin Dráb Profile Picture
    Martin Dráb 230,900 Most Valuable Professional on at
    RE: unable to send batch job execution history while record insertion in BatchJobHistory table

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,074 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,900 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans