Automatically sending out emails (Straight through processing)

As part of your processes, there may be documents that you require to be sent out without the need for a human touch, and you just want the system to do it. This is referred to as "Straight through processing".

Straight through processing is an automated process done purely through electronic transfers with no manual intervention involved. 

This article will guide you through the steps involved in setting this up in Sharedo as part of a workflow.

Please note: The examples given are based on the email delivery method, but this could also be applied to other methods. This is also based on the configuration (phase models etc.) from the Sharedo core environment and this may vary in other environments.


This method uses a mixture of document and workflow configuration, please ensure to follow all of the below steps carefully.

Step 1 - Configuring Document Actions

You will firstly need to configure the following 2 actions against the document that will be emailed out.

This is done by navigating to your Documents Admin area via Launchpad or alternatively typing /admin-documents after the URL in your address bar e.g. https://mycompany.sharedo.co.uk/admin-documents

Once in Documents Admin, select Document Templates > Document Templates on the left nav.

Locate your document and double click, then choose the Document Actions option at the bottom of the blade.

A new action can then be added by clicking Add at the top right.

1. Jump to Phase - This configuration shown below will automatically jump the document from the In Progress phase (which is the phase that the document is in once the user has generated the document) to the Drafted phase. Ensure to tick "Bypass phase guards".


2. Create Document Delivery - The following configuration will automatically process this document via the Email delivery channel/method when it reaches the Drafted phase. Ensure to tick the "Auto send if all fields can be populated" - this will then send the email out providing all tags on the document template and the email cover template have been populated successfully. It also requires a further user setting to work correctly (see below point 3).

3. Set Send From on user profiles - Important: Ensure that under all necessary (e.g. the users that will be assigned to the document tasks) profiles/personal details the Send From option is selected correctly, else the email will fail to send.


Step 2 - Configuring Workflow

You will need to have the following 4 toolbox items on your workflow step for this to work correctly. We need to use custom JavaScript to achieve this and for the system to fill out the details that a user would usually have to do manually.

 

1. Prepare document - This will create the Prepare document task on your work item and there is no special configuration needed here.

2. JavaScript #1 - The first JavaScript toolbox item will update your Prepare document task on creation and tell it what DMS (Document Management) folder the generated document should be stored in. The properties for this should look like the below:

The text that can be copy & pasted into the properties of your JavaScript item for ease is below:

actions.sharedo.Http.Post("/api/sharedo/" + ctx.pHScheduleOfLossesTaskID + "/attributes/",            
{
id: ctx.pHScheduleOfLossesTaskID,
                attribute: "DocumentClass",
value: "Correspondence"
            }
            ).Result;

Note: The task ID "pHScheduleOfLossesTaskID" will need changing in both places to match the outputted variable of the Prepare document task ID in your workflow. If you wish to use a different folder, update the "Correspondence" line accordingly.

3. JavaScript #2 - The second JavaScript toolbox item will update your Prepare document task on creation and tell it the title for the generated document. The properties for this should look like the below:

The text that can be copy & pasted into the properties of your JavaScript item for ease is below:

actions.sharedo.Http.Post("/api/sharedo/" + ctx.pHScheduleOfLossesTaskID + "/attributes/",
            {
id: ctx.pHScheduleOfLossesTaskID,
                attribute: "Title",
value: "Policy Holder - Schedule of Losses"
            }
 ).Result;

Note: Again, the task ID "pHScheduleOfLossesTaskID" will need changing in both places to match the outputted variable of the Prepare document task ID in your workflow. You will need to specify the title on the "value" line, replacing the example text "Policy Holder - Schedule of Losses".

4. Progress milestone - The Progress milestone item will transition the Prepare document task to the "In Progress" phase automatically, essentially replicating a user clicking the "Generate document" button.

As below, you will need to choose the ID of the Prepare document task, choose Prepare document as the expected work type, and select the relevant phase in line with your system configuration.


Once the above configuration steps have been followed correctly, when the workflow step is triggered, the email will be sent out automatically.