Counting Completed Documents
Intro
This is a guide to system admins to help them count submitted documents in 3B Onboarding, versions 6 and lower.
With the launch of the new 3B Portal UI, the Document Assignment Completeness and Status must be now managed via custom automation.
This document provides the details of two Salesforce Flows that used as a guidance to implement the automation required to manage the Document Assignments Completeness and Status
Flow to manage the Document Assignment Completeness
As depicted in the picture below, the Flow is triggered when a Document Submission is created or edited, with no entry conditions defined.
Then, the Flow is broken into 3 blocks.
First Block
In the first block, we use the Get Records component to get all the Documents from the Document Pack that is associated with the triggering Document Submission record (use 'Flow Step -1.1' below as a reference).
We also use the Loop and the Assignment components to loop through each Document record and set a couple of Flow variables (use 'Flow Step -1.2' and 'Flow Step -1.3' below as a reference).
In the “Doc + 1” Assignment Component, we set the “DocCount” variable which is used to count the number of Documents associated with the Document Pack. We also set the “RequiredDocs” variable which is used to store the names of all Documents associated with the Document Pack. The Screenshot 'Flow Step 1.4' and 'Flow Step 1.5' below show how the above-mentioned Flow variables are configured.
Second Block
In the second block, we use the Get Records component get all the Document Submissions related to the Document Assignment that is associated with the triggering Document Submission record (use Flow Step - 1.6 below as a reference). We also use the Loop, the Decision, and the Assignment components to loop through each Document Submission record and to set Flow variables that determine if there are documents missing and calculate the Document Assignment completion percentage (use Flow Step - 1.7 to 1.11 as a reference).
Flow Step - 1.7 - "loop Actual Submissions” Loop Component - In this component, we loop through the submissions and count unique, non-rejected items.
Flow Step - 1.8 - “Submission Status” Decision Component – In this component, we check the status of the Submission and ignore any that are rejected.
Flow Step 1.9 - “Unique Status” Decision Component – In this component, we check if a Submission belonging to the same Document has already been processed. Note that we use a variable called “DocumentIds” in the check. The configuration of the “DocumentIds” variable can be found in Flow Step 1.12.
Flow Step 1.10 - “Submission + 1” Assignment Component – In this component, we set two Flow variables i.e. “SubmissionCount” and “RequiredDocs”. The configuration of the “SubmissionCount” variable can be found in Flow Step 1.13 below. The configuration of the “RequiredDocs” variable was provided in Flow Step 1.5 above. Note also that we use a Formula variable - i.e. “OutstandingItems” - to set the “RequiredDocs” variable. The configuration of the “OutstandingItems” formula variable can be found in Flow Step 1.14
Flow Step 1.11 - (“Unique Storage” Assignment Component – In this component, we store variables about the Document Submission to check uniqueness as we loop. The variables we use for storage in this component are “DocumentIds” and “RequiredDocs”. The configuration of the “DocumentIds” variable can be found in Flow Step 1.12 below; the configuration of the “RequiredDocs” variable can be found in Flow Step 1.5 above; and the configuration of the “OutstandingItems” formula variable can be found in Flow Step 1.14. Note also that we use a Formula variable - i.e. “DocumentId” - to set the “DocumentIds” variable. The configuration of the “DocumentId” formula variable can be found in Flow Step 1.15)
Third Block
In the third block, we use the Update Records component to update a couple of custom fields in the Document Assignment record associated with the triggering Document Submission (use Flow Step 1.16 below as a reference).
The fields that are updated in this component determine how complete is the Document Assignment.
Flow Step 1.16 - (“Add Completeness” Update Records Component)
The custom fields “Complete__c” and “Outstanding_Items__c” must be added to the Document Assignment object. The “Complete__c” custom field is a field of type “Percent” and the “Outstanding_Items__c” custom field is a field of type “Long Text Area” (use Flow Step 1.17 and Flow Step 1.18 below as a reference).
Note also that the “Complete__c” custom field is set using a Formula variable i.e. “CompleteCalc”. The configuration of the “CompleteCalc” variable can be found in Flow Step 1.19.
Flow to manage the Document Assignment Status
The Flow to manage the Document Assignment Status is very simple.
It is triggered when the “Complete__c” custom field in the Document Assignment record is updated.
Then, we use a Decision component to determine whether the assignment is completed or not. If the assignment is completed, then the corresponding Update Records component sets the Status field to “Submitted”.