Home Blog Making Enabled Approval Workflows Optional in Acumatica

Making Enabled Approval Workflows Optional in Acumatica

Brian Stevens | November 16, 2021

Making Enabled Approval Workflows Optional in Acumatica

Introduction

Years ago, an approval process consisted of workers passing a paper form around the plant for any necessary approval to complete business processes.  Typically, these would go in intercompany mail envelopes, but urgent cases would be hand carried through the process.  In one case, a client would call all the stakeholders of one process together for a weekly meeting to review many requests and approve or reject each request as a review board.  As you can imagine, these paper approval processes and weekly meetings were exceptional at slowing down decision making and material procurement.

Fast forward a few years (or decades) to Acumatica ERP.  With a robust approval engine, paper has been replaced by streamlined electronic approvals complete with notifications, approval via browser or mobile app, and decision making that runs at the speed of business.  The approval engine can be leveraged in custom screens, and various conditions can be defined to automate certain approvals and rejections according to the business requirements.

While the electronic approval is far from new in the current era of digital computing, business processes are not always cut and dry when it comes to approvals.  Some business processes may require a periodic review, and only recommendations for change should be sent for approval.  The challenge comes in differentiating between a “reviewed” document and an “approved” or “rejected” document.

Business Case

SETECH Supply Chain Solutions manages indirect materials for their clients.  At the core of their services is Plan for Every Part. This core business process requires each inventory item be reviewed periodically to ensure that the availability of materials aligns with their clients’ needs.  The business requirement states that a plan that has been reviewed should result in a status of Reviewed, but plans submitted for approval should follow the normal approval process of resulting in Approved or Rejected status.  Since the standard approval process, when enabled, results in either Approved or Rejected, a customization was needed to support conditionally bypassing the approval process and setting the status to a third state called Reviewed.  The standard approval process seeks an approval map and automatically creates a record in the Approval Details tab, so even a plan marked Reviewed would have an orphaned approval record which was misleading.  Also important to note is the version in use is Acumatica ERP 2021 R1.

While the new workflow engine easily changes the status to Reviewed, preventing the orphaned approval record requires some creative coding.

Solution

First, the DAC fields must be defined to support the approval process.  Notice the standard hold, approved, and rejected fields.  Now noticed the addition of an extra field called RequestApproval which will be set according to the value of the Setup record (from a Preferences screen) enabling or disabling approvals.  This field will be used by the workflow on the custom screen to programmatically determine if the conditions of the record require an approval be submitted.

 DAC Fields

GIST: https://gist.github.com/BrianMRO/4063f8214a301c36b1f3516dd96f0e63

Next, the views must be defined.  The primary view for MyDAC is called Document, and the Setup Approval view for MySetupApproval is called SetupApproval.  This is the table that contains the Approval Maps defined in the screen’s approval setup.  Because this table contains the approval maps to be used by the approval engine, a constructor is used to return null if the plan (MyDAC) does not require approval according to the RequestApproval field.  This constructor is the “magic” that prevents an orphaned record from populating the Approval Details tab.

Setup the Views

GIST: https://gist.github.com/BrianMRO/d1cc58b6deff39ff48d4c08b8f645b90

Next, the approval system needs to be added.  The approval engine is specified by inclusion of EPApprovalAutomation, referencing the hold, approved, and rejected fields of MyDAC as well as the Setup Approval table MySetupApproval.  For convenience, the CacheAttached code for EPApproval have been included as a reminder that these fields must be specified to bring the values from MyDAC to the standard approval screen.

Add Standard Approval Setups

GIST: https://gist.github.com/BrianMRO/0d1a2baa173dad741300246cb519cae6

Finally,  the approval optional requires setting MyDAC.RequestApproval according to business logic when the RemoveHold action executes.  (RemoveHold is defined in the new UI workflows to replace unchecking the hold checkbox in older versions of Acumatica.)  In this business case, modification of certain values require approval, but other values can be updated as part of a simple review.

Make Approval Optional

GIST: https://gist.github.com/BrianMRO/1fb4359ee10b740c3d25d0b05e55f288

Notice the very important step of refreshing the SetupApproval view.  This refresh causes the list of approval maps to be complete or emptied.  It is the lack of an approval map to select that prevents the orphaned record on the Approval Details tab.

To complete the setup, the workflow was modified in the Customization Project UI to transition from Hold based on the setting of the RequestApproval field.  The following describes the states and transitions used to control the flow of the planning record.  When removing hold, a plan marked RequestApproval = false will transition to Reviewed while a plan with RequestApproval = true will transition to Pending Approval.

Summary

From rising labor costs to above average inflation on virtually every purchase, the cost of business seems to be skyrocketing past the breaking point for many companies.  Although finance has always focused on cost control, managing costs through every business process has never been more critical.  Fortunately, Acumatica provides a robust approval workflow capable of injecting cost-conscious approval requirements tailored to each business ranging from every purchase to only those reaching a specified threshold.  With a little creative customization, this robust framework can be applied to other business processes as well.  In this post, I showed how you can use a simple customization to manage a core business process around inventory availability that leverages a full client-included workflow approval for changes or an optional path of internal review when no changes are recommended.

I hope you found this helpful – Happy Coding!

 

Blog Author

Brian is the lead developer for SETECH Supply Chain Solutions, LLC. SETECH provides tailored solutions based on best practices to improve the availability of indirect materials while reducing the total cost of ownership for their clients.

Receive blog updates in your Inbox.