Approval Process Reminders

Few years ago I published code for approval process reminders, recently I modified this code with some alignment/improvements + convert the relevant UI to web component.

The main request is that if approval process is pending on the same person for more than X hours a reminder should be sent to this person (+potential other recipients), and then after every X hours additional reminder should be sent until the approval received.


For the updated solution I'm using my free app: Asynchronous Process Manager / Creator, which allow to easily set and monitor background jobs and it provide some other core components that being used and save some efforts.


For the reminder process using the following components (all available in git): 

  • Custom object: Approval Process Reminder- Setup for specific approval process
  • Custom object: Approval Reminder Record- Reference for specific record that is pending approval
  • Custom tab: Manage Approval Reminders- shows the current reminders setup + option to modify each.
  • Web Component: ManageApprovalProcessReminders - used in the tab
  • Few apex classes for the server side processing
    • ManageApprovalProcessReminderCotroller - main logic for the web components
    • ApprovalProcessReminderService - logic for sending alert
    • ApprovalReminderBatch - batch process that run over all active process and search for pending approval processes


How to install:

1.Install free app Asynchronous Process Manager / Creator

2.Go to tab MBA Settings and click Start Scheduler 

3.Install the Approval Process Reminders or get from the code from Git

4.Set up your approval reminder as in the demo.




Considerations/Limitations:

  • The process assume you won't have hundreds of records pending approval under the same process. If you do have you might need to do some code refactoring to support that.
  • The process doesn't support Queues, only users. If your approval assigned to queue, you might need to apply some changes, depending on what you expect to happen.
  • The approval process data (ProcessInstance) is a setup data that cannot be created in test classes. Therefore the tests trying to use the first existing approval process. If your org doesn't have any approval process code coverage might be lower, but still should be enough for installing.
  • When starting the process you can configure the minutes interval. Although you can set lower minutes value, I recommend to have at least 30 minutes interval.
  • Some users in the company will dislike you :-)

3 comments:

  1. Hello! Thank you for your APP. Is there away I can adjust the code to modify the email?

    ReplyDelete
    Replies
    1. Clarification: There is an email template I would like to use for this, and am wondering if I can swap it out.

      Delete
    2. Hi. Note first that the code is open source, therefore you can change everything.
      To use email template you will either need to populate additonal fields in the log_message that being used
      to send alerts, for example:
      newLog.mba_services__Send_Email_With_Template__c = true;
      newLog.mba_services__Email_Template_Id__c = 'templateId';
      newLog.mba_services__Related_Record_Id__c = recordId;
      newLog.mba_services__Sender_Name__c = 'Automation Process';
      newLog.mba_services__Reply_To__c = 'noreply@app.com;

      or modify the whole code and user Salesforce EmailMessage instead.

      Also you might want to look on the latest article that suggest similar solution without the git code. At
      the end I wrote how to use email template.

      https://lc169.blogspot.com/2022/07/approval-process-reminders-without-code.html

      Delete

Retire of Permission on Profiles

If you are working as a Salesforce admin/developer you've probably heard somewhere that Salesforce is planning to make a significant cha...