Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Answered

Automatically post G/L Journal after approval

Posted on by 159

Has anybody been able to automatically post G/L Journals in Business Central after they have been approved? Either through workflow or job queue (without custom coding)

  • Theo Kersten Profile Picture
    Theo Kersten 159 on at
    RE: Automatically post G/L Journal after approval

    Thank you for your detailed steps Rob!

    You're using approvals in Power Automate, but we've setup all other approvals using the BC workflows, and users want one source for outstanding approvals.

    However, you definitely gave me some ideas to start working on.

    Thank you!

    And thank you MahGah for submitting the idea to Microsoft, I voted !

  • Suggested answer
    Rob F. Profile Picture
    Rob F. 483 on at
    RE: Automatically post G/L Journal after approval

    Hi Theo, yes it's possible, we have this working currently using Power Automate.  Our workflow is a bit complicated and Power Automate has been an excellent tool to handle it all, but there are some caveats to be aware of as well.  I can't post a screenshot of the complete workflow as it's too big, but here are the main components:

    Start with the standard out of the box trigger and action to get the workflow record.  These are created automatically if you use the Power Automate template, or you can start from scratch with a blank template.

    pastedimage1646153509682v2.png

    Go through the approval action.  Since our workflow has a few branches depending on certain conditions, we use a variable to set the approval outcome.

    pastedimage1646153587082v3.png

    Process the approval outcome.  To post the journal add the Execute action step and use the Id field from the Get workflow record step above.

    pastedimage1646153749023v5.png

    Now for the caveats:

    • You will notice there is a Delay step inserted between the Approve and Post steps.  We ran into errors at times during testing due to the timing of these two steps, and also some table locking issues when more than one workflow was running at the same time.  The delay seems to help with that.

    • In general, error handling with can be a challenge, but there is a way to do it that I can post about here as separate message later.  The biggest drawback is that currently in BC when a user submits a journal for approval there is no error message that blocks them if the journal batch contains issues such as invalid dimension combinations or posting date restrictions; this only happens at posting time.  The user would get a warning if they use the Preview Posting function, but our users frequently forget to do that and it's not until the workflow attempts the Post step that it fails with an error.

    • If a user cancels an approval request in BC, it does not sync with the Approvals app used in the Power Automate workflow, or the workflow itself.  This means the approval request needs to be separately cancelled in the Approvals app or the workflow needs to be manually cancelled by a workflow owner.  Hopefully this will be improved by Microsoft in the future because it causes a lot of confusion right now.

    • BC does not have a Status field for journal batches, so it's impossible for users to determine if a batch has been submitted or approved in BC.  They need to use the Approvals app in Teams to monitor the status, and we had to add extra notifications in the workflow.  Another drawback that will hopefully be improved in the future.  The link to Idea for this is here.

    • Power Automate uses the user account that is configured in the BC connector to perform the posting step, not the user that submitted the request, and so the connector user will need to be setup in BC with the appropriate security permissions and posting dates in order for it to successfully post.

    Feel free to DM me if you have any other questions on this.

    Rob

  • Suggested answer
    MahGah Profile Picture
    MahGah 15,419 on at
    RE: Automatically post G/L Journal after approval

    I submit the idea here just in case if someone wants to vote for it

    experience.dynamics.com/.../

  • Suggested answer
    MahGah Profile Picture
    MahGah 15,419 on at
    RE: Automatically post G/L Journal after approval

    Theo Kersten

    Thanks for info. If you accomplish this task and if you do not mind post the full solution here just to help other members as well. Thanks

  • Theo Kersten Profile Picture
    Theo Kersten 159 on at
    RE: Automatically post G/L Journal after approval

    Thank you MahGah and Kim!

    Those posting code units cannot be used in a BC job queue; it errors out on "Record 472 (Job Queue Entry) is not compatible with Record 81 (Gen Jnl Line)"

    But I love your idea on the Power Automate. I got this flow to post the journal; now I just need to find a way to edit and control which journal batches to post.

    Thank you!

    pastedimage1645461683831v1.png

  • Suggested answer
    MahGah Profile Picture
    MahGah 15,419 on at
    RE: Automatically post G/L Journal after approval

    This is just theory and I have no method to test it 

    I think if we run Codeuint 13 in Job Queue then maybe we can post the Journal. You can test this in Sandbox. The challenge is you need to run this Codeunit after approval. Now if you can find the method that work flow can trigger Power Automation after approval and Power Automation can run the Codeunit 13 then maybe you can do this. 

    Following chart from www.oreilly.com/.../0d7dc814-43ba-4a33-a7d6-8b3c2b2ac56e.xhtml

    pastedimage1645460075200v1.png

  • Verified answer
    Dallefeld Profile Picture
    Dallefeld 11,423 User Group Leader on at
    RE: Automatically post G/L Journal after approval

    I tried to set this up and did a great deal of research. It is not possible in standard BC. Like MahGah stated, maybe with Power Automate.

  • Suggested answer
    MahGah Profile Picture
    MahGah 15,419 on at
    RE: Automatically post G/L Journal after approval

    Hi

    I heard it is possible to do this through Power Automation but I could not find anyway using workflow or job queue yet

    https://yzhums.com/8295/

    Maybe use the following flow then add extra action to them something like 

    joshanglesea.wordpress.com/.../

    pastedimage1645458802950v1.png

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

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

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,558 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,647 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans