Why You Should Always Customize Dynamic NAV Workflows

Posted By
BDO

The generic version of Microsoft Dynamics NAV includes a number of preconfigured workflows. However, those standard workflow templates cover just a few possible NAV tables. Microsoft suggests that partners build their own customizations within existing workflow framework to meet clients’ needs.

Below you will find an example of customization and configuration BDO IT Solutions can build for the Vendor Bank Account table workflow.

Scenario:

BDO IT Solutions was asked to create a workflow to support the following behaviour:

  • If Vendor Bank Account record was inserted or modified, then send an approval request to an approver;
  • Restrict using the Vendor Bank Account record in Payment Journal – Export functionality;
  • Remove the restriction once the request has been approved or canceled;

Customized NAV Objects and Customization Reasons:

Codeunit 1520 Workflow Event Handling

  • New functions to handle events (based on similar standard NAV functions for Vendor record):
    • RunWorkflowOnVBAccChangedCode,
    • RunWorkflowOnVendorBankAccountChanged, RunWorkflowOnSendVBAccForApprovalCode,
    • RunWorkflowOnSendVendorBankAccountForApproval,
    • RunWorkflowOnCancelVBAccApprovalRequestCode,
    • RunWorkflowOnCancelVendorBankAccountApprovalRequest
  • Added code to CreateEventsLibrary(), AddEventPredecessors() to support Vendor Bank Account
  • Reason:
    • Track Vendor Bank Account record changes
    • Support generating approval request for Vendor Bank Account
    • Support canceling approval request for Vendor Bank Account
    • Support events tree
      • Create predecessor’s events, so certain events are available in combination with other events and appear in the lookups
        • “Send approval” event is a predecessor for Approve, Reject or Cancel Request events

Codeunit 1521 Workflow Response Handling

  • Added code to AddEventPredecessors() to support Vendor Bank Account
  • Reason:
    • Support events tree
      • Create predecessor’s events, so certain events are available in combination with another event and appear in the lookups
        • Supporting predecessors for Revert Value event

Codeunit 1535 Approvals Mgmt.

  • Added functions:
    • OnSendVendorBankAccountForApproval
      • Integration Event
    • OnCancelVendorBankAccountForApproval
      • Integration Event
    • CheckVBAccApprovalsWorkflowEnabled
      • Check if Vendor Bank Account workflow is enabled
    • Reason:
      • Support approvals for Vendor Bank Account
        • To make Vendor Bank Account available for standard Approval engine
        • Vendor Bank Account will appear in “Request to Approve” table, and then will be processed based on user’s decision (Approve, Reject or Delegate)

Codeunit 1550 Record Restriction Mgt.

  • New function:
    • VBAccCheckGenJournalLinePostRestrictions
      • EventSubscriber
        • Called from general journal line
        • Table specific
          • If the similar event should be caught on another table, a separate function should be created.
        • Reason:
          • To check if Vendor Bank Account record selected in payment journal (Recipient Bank Account field) has any restrictions
            • Using standard engine to find the record in the Restricted Records table

Page 256 Payment Journal

  • New code to action Export to check if a record is restricted
    • OnCheckGenJournalLinePrintCheckRestrictions
    • In standard NAV, this is done for Checks only
      • See code unit 229 Document-Print

It is important to note that all of the above is strictly specific for Vendor Bank Account table only, but can be used as a prototype for building similar functionality for other tables.

Configuring workflow settings for Vendor Bank Account table.

Configuration includes:

  • Workflow Event/Response Combinations;
  • Workflow – Table Relations;
  • Workflow Event Hierarchies.
  1. Make sure Event/Response combination for Vendor Bank Account record is the same as for Vendor record. 
  2. Create record in Workflow – Table Relations 
  3. Make sure Workflow Event Hierarchy for Vendor Bank Account record is the same as for Vendor record. 

Creating a workflow to support Vendor Bank Account table.

Configuring workflow events and responses:

Details of the response which sends an approval request:

How does customized workflow work?

  1. User inserts/modifies Vendor Bank Account record: 
  2. NAV automatically sends an approval request to an approver:
  3. An approver receives Approval Request and a record appears in “Request to Approve” page:
  4. The Vendor Bank Account record appears in Restricted Record page:
  5. If the user tries to process export payment for payment journal line with Recipient Bank Account value equal to restricted record, an error will be raised.
  6. Once the approver approves the request, the Vendor Bank Account record is removed from Restricted Records: 
  7. After that, the modified Vendor Bank Account record can be used without restrictions.It is important to understand that restrictions of vendor bank account record are implemented only for export payment in this case. In all other areas, there are no restrictions for the record, even if it is listed in Restricted Records. That means if any part of the application is supposed to be used with Restricted Records functionality, that area should be specified for the customization.As we can see, customization of the generic Dynamics NAV workflows is a very powerful tool and allows to extend existing workflow framework to other areas of Dynamics NAV. Based on the business requirements, a combination of customizations and standard configuration can meet a client’s requirements.

 

BDO eBook - The Cloud Changes the Game

There are times in the course of your business when you have the opportunity to dramatically accelerate growth and improve day-to-day efficiencies. Recognizing

Download