Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

document approval request send automatic

(0) ShareShare
ReportReport
Posted on by 10

Is it possible that the "Send Approval Request" Action is done automatically by the System after saving an order?

My Problem is that we use "Requisition worksheets" to generate orders. After the requesition a lot of orders are kept in the System without having started the workflow for approval requests

Thanks and best regards

*This post is locked for comments

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: document approval request send automatic

    That is true Joerg..

    How do you still handle the people, who are manually creating the order? If system is running every hour, system would send the document for approval, even though people are creating the order.

    So, if you can identify the orders being created via Requisition (via some filter), and skip the manually created order, you can go with Job Queue. This can be implemented easily by creating simple report and run periodically as per your need.

  • RockwithNav Profile Picture
    RockwithNav 6,562 on at
    RE: document approval request send automatic

    Hey Jorge,

    1st immediately after saving the order i.e. with a dialog box asking if the approval shall start and then executing the code from above.

    - I believe There Shouldn't be any manual intervention of Users if you are running something on a  Job Queue Level. It should run on some conditions/Status.

    2nd for every order in Status "open" which is older than 1 hour. This gives the possibility to edit the order before approved!

    - This one be an option to execute but instead of an Hour if you will play on some other logic then it will be better as every time and for every order system will have to first check the Order and then calculate time.  Though job Queues execute very fast but still on performance point of view you may think once on this.

    Thanks

    Blog - rockwithnav.wordpress.com

  • joerg.waldner Profile Picture
    joerg.waldner 10 on at
    RE: document approval request send automatic

    Hi,

    the Advantage of solution #2 would be that the People have the Chance to Change something in the order before starting the approval request.

    Is there an easy way to set it up?

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: document approval request send automatic

    Both seems fine.

    If we have to choose one, I would suggest to go with first one to avoid any delay (of one hour).

    If you choose second one, there  might be chance that people are manually creating the order and would go into approval automatically. Hence this needs to be taken care by some filters.

  • joerg.waldner Profile Picture
    joerg.waldner 10 on at
    RE: document approval request send automatic

    There are 2 possible ways to do so. I don't know which one is easier.

    1st immediately after saving the order i.e. with a dialog box aksing if the approval shall start and then executing the code from above.

    2nd for every order in Status "open" which is older than 1 hour. This gives the possibility to edit the order before approved!

    Do you know how to set it up?

    Best regards

  • joerg.waldner Profile Picture
    joerg.waldner 10 on at
    RE: document approval request send automatic

    Thanks for the code. We found a way to test it. It was not exactly the correct code because I think it's a code for NAV2016.

    For NAV2015 this is the code:

    FinalizeOrderHeader between COMMIT and “CarryOutAction.SetPrintOrder(PrintPurchOrders);

    //

    IF ApprovalsManagement.CheckApprPurchaseDocument(PurchOrderHeader)  THEN

     ApprovalsManagement.SendPurchaseApprovalRequest(PurchOrderHeader);

    //-

    ApprovalsManagement in C/AL Globals defined in Codeunit 439 ….

  • RockwithNav Profile Picture
    RockwithNav 6,562 on at
    RE: document approval request send automatic

    Hey Joerge,

    Its very easy to make this Process automatically i.e. Send Approval Request. But to make this process execute by itself you have to first determine at which point of time will it execute or what command you are willing to give as input that at this point of time it should execute the process. Is there any status you are maintaining for this.

    If i am not wrong Order will be getting released once it is approved. Once you are clear on this, definitely  it can be done with Job Queue and will execute for each and every created Sales Order.

    Thanks

    Blog - rockwithnav.wordpress.com

  • joerg.waldner Profile Picture
    joerg.waldner 10 on at
    RE: document approval request send automatic

    Thank you very much for the code lines.

    As I am an enduser without any possibility to enter code in NAV2015 I can not test your code.

    Is there any other easy possibility to start the approval workflow.

    I supposed to do it with a Job Queue starting the approval for all orders that are older than i.e. one hour.

    Is there a possibility to do so?

    Thanks for your answers!

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: document approval request send automatic

    Hi,

    You can go for the customization to achieve this..

    You can try with following code in CU 333 > FinalizeOrderHeader Function and see the result.

    After COMMIT function, add following lines.

    //++

    IF ApprovalsMgmt.CheckPurchaseApprovalsWorkflowEnabled(PurchOrderHeader) THEN

     ApprovalsMgmt.OnSendPurchaseDocForApproval(PurchOrderHeader);

    //--

    Before following line

    CarryOutAction.SetPrintOrder(PrintPurchOrders);

    Hope this helps.

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,735 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,466 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans