If you are looking for ideas to combine the declarative, point and click tools along with the programmatic power of Apex code, take a look at this sample solution to implement dynamic approval routing including better delegated approver support.

The sample solution shows how custom objects, apex classes and triggers and approval processes come together to build a dynamic, data-driven approach to approval process automation. Use the apex code snippet listed in the sample solution  to handle scenarios where you want to send the request to a delegated approver when the main approver is on vacation.

The Apex code included in the App Exchange package serves as a good example to highlight some important best practices when writing apex code:

  • Test Driven Development – Make tests an integral part of your application and strive for 100% code coverage.
  • Code for bulk triggers – Effective usage of Set and Map data structures to code for bulk triggers and ensure that you are within the governor limits.

Get the latest Salesforce Developer blog posts and podcast episodes via Slack or RSS.

Add to Slack Subscribe to RSS