As many of them asked me to attach the .fob file. I’ve attached a link at the bottom for your reference.
For Part 1 chick here
Hi folks! I’m back with Part 2 of how to create custom approval workflow in Dynamics NAV. An overview of Part 1, we created an Event Publisher then we created function for sending approval then for approval, for reject and delegate. Part 2- Now we will continue with how to add these event functions to the library.
Microsoft Dynamics NAV 2017
2. Open Approval Management Codeunit in design mode and the following code under the function SetStatusToPendingApproval
3. Open Workflow Response Handling codeunit and add the code under ReleaseDocument and OpenDocument respectively
4. Add the Database to Codeunit 700 Page Management. This will enable the approver access to approve, reject open the record. Here Database should be Job
5. Add the table to Codeunit Notification Management to get notification for your approval process.
5. In the Text constants, we add the texts.
6. In the RTC, navigate to the Workflow Event/Response combination, check the appropriate response for the events.
7. In the workflow Table Relation create a relation between Job table and approval entry table with the field the Record ID to approve.
8. Now to enable a workflow navigate to Departments/CRONUS International Ltd./Departments/Administration/Application Setup/Workflow
9. Click on Workflows then on New. This will create a new workflow design. Enter the workflow code, description and category.
10. Select your event ‘Approval of Job is requested’. This is the event added to the library. Add response to it.
11. In the next line select the next event, An approval request is approved and add response to it.
12. In workflows only the first event is primary the second event should be indented to it so for the events after the primary event we increase the event.
Now enable the workflow.
13. Now we need to set up the approver who will approve the request. Navigate to Approval User setup. Select the approver ID from the drop down and set the approver as approval administrator.
for more information of how to setup approval user setup refer https://chrisdsilvablog.wordpress.com/2017/10/25/approval-workflow-setup-and-process-in-microsoft-dynamics-nav-2017
14. In the response for the first event we use the approver type as workflow user group and set the username as a workflow user group approver
for more information about workflow user group refer https://chrisdsilvablog.wordpress.com/2017/11/06/approval-workflow-using-workflow-user-group-in-microsoft-dynamics-nav/
15. Now the setup for workflow is done, we can test it by navigating to jobs and clicking on send approval request button. The status changes to pending approval and request is sent to the approver via email
16. Email notification will be provided. To implement this you need to setup the SMTP email set up and provide the from email address.
for information how to setup Notification Email refer https://chrisdsilvablog.wordpress.com/2018/07/17/how-to-send-email-notification-to-users-using-workflow/
17. Navigate to sent notification entries in the search box and you can see the entry for the email sent.
18. Navigate to Approval Request Entries in the search box, we can view the sender ID and the status with date and time and Last modified by user. Here the approval Status is open as it is not approved by the approver.
19. Now you need to sign in as the approver and approve the request, so now I sign out of my account. The approver signs in the account and in NAV he navigates to Request to Approve.
20. The approver can either approve it or reject it. Open Record button opens the record and the approver can view the job document.
21. On click of approve, the record deletes and the document is approved.
22. Navigate to the Approval Request Entries, we can view the view the status.
23. Navigate to jobs and check the status. The status is changed to released.
Thanks for reading. Post your feedback in the comments section. You can also email me your queries from Contact Me https://chrisdsilvablog.wordpress.com/contact-me/