Straatos Tutorial - Invoice Processing

Objective

This tutorial shows how a sample invoice process can be configured.

 

At the end of this tutorial, you should be able

 

Process Overview

 

Prerequisites

This section details the Admin Panel Organisation setup necessary prior to setting up the workflow. If the organisation is already setup you can skip this section.

 

Creating the Workflow

1. Creating a new Workflow

In this step, we create a new workflow

  1. Log in to the CumulusPro Admin Panel with your Credentials
  2. Open your organisation you want to create the workflow
  3. Click on 'Workflows'
  4. Click on the 'Create Workflow Configuration' tile
  5. Name the new 'Invoice Tutorial' and then click on the tile

Watch this video on how to create a workflow:

 

 

2. Adding Index Fields

In this step, we will add some index fields. The index fields created here are only available in the workflow and are separate to the index fields you may have created on your Document Types.

If you want the index field values from your Document Types in the Scan or Mobile clients to be passed to your Workflow, create an index field in the workflow with the same name as you created them in the Document Type.
  1. Click on the + next to the Index Fields
  2. A new field 'NewField1' has been created.
  3. Click on the index field
  4. Change the field display name, Field name and  Datatype according to the table below.
  5. Repeat step 1 to 4 for the remaining fields.

 

Name

Display Name Datatype
InvoiceNumber Invoice Number string
InvoiceDate Invoice Date date
PONumber PO Number string
TaxPoint Tax Point string
NetTotal Net Total amount
TaxTotal Tax Total amount
GrossTotal Gross Total amount
Currency Currency string
DocumentType Document Type string
SupplierCompanyName Supplier Company Name string
SupplierTaxID Supplier Tax ID string
RejectURL RejectURL string
EmailFrom EmailFrom string

 

 

StartEvent - Scan/Mobile/Email Import

In this section we create a start event that gets documents from one of our own apps, such as Scan+ProcessLite, Scan+Express, Mobile Capture or from any iConnector compatible application.

 

 

 

 

Creating the flow - StartEvent

 

Click on the Design Process Button

 

This will open an empty process designer. On the left side, you find the steps that can be added to the process. We start by adding a StartEvent.
 
A StartEvent is the beginning of a workflow. This is where documents from Scan+ProcessLite, Scan+Express and Mobile Capture enter the workflow. Additionally, email and FTP import  can as well be configured at a start event and third party integrations such as Zapier can use a start event to send documents to CumulusPro.
A processflow can have multiple StartEvent, one for each document type if necessary.

Click on the StartEvent icon and drag it onto the design canvas:


Your screen should now look like this:

To edit the properties of the StartEvent, click ont the Settings icon:

This opens a pop up showing the settings for the StartEvent

Select the Document Type from the Dropdown. In the screenshot above, the document type 'Invoices' has been selected. However, the names available depend on the names give in the section 'Pre-Requisits'.

 

Start Event for Email Import

  1. Create a second start event
  2. Click on the Settings
  3. Leave the document type empty
  4. Open the +Mail Polling
  5. Complete the settings.
    1. The IMAP Server, Port and Username/Password depends on your server. If you do not have an email account, you can skip the email import part.
    2. Select 'Active' to ON, this will enabel the email import.
    3. Map the email fields to the index fields, for example 'From' choose 'EmailFrom' from the dropdown list.
    4. In case of an error, the Mail Pooler Error Message will display what has gone wrong.

 

Create an OCR Task

In this section, we create a Task that performs Optical Character Recognition (OCR) from the two Start Events.

 

 

 

 

  1. Drag the 'Service Task' onto the canvas
  2. Name the Task 'OCR'
  3. Click on the Task Tile
  4. Select Settings
  5. Select 'Abbyy OCR Searchable PDF'' from the 'Action' dropdown
  6. Close the OCR dialog by pressing the x on the top right.

Now, connect the start event to the OCR task

 

  1. Click on the top start event, then click on the arrows
  2. Drag the arrow on top of the OCR tile
  3. Repeat the above for the second Start Event

Your diagram should look like this:

 

To make the diagram easier to read, we now adjust and label the arrows.

  1. In the diagram above, we would like to adjust the arrow from the top start event to enter the OCR box from the top. In oder to do this, click on the arrow. The arrow is shown in a red-dashed line and the corners are marked in yellow.
  2. Click on the connector and move it to until the arrows align.

The result should look like this.

 

Now that the lines are drawn, we label them to indicate the input.

  1. Doubleclick on the line from the top start event
  2. Enter the name 'Email Import'
  3. Drag the Label near the start event
  4. Repeat the above steps for the second arrow and label it 'Scan/Mobile'

Your process should look like this:

 

Metadata Extraction

The next step we add is to extract Metadata. While we could follow similar steps to adding the OCR Task, we explore an alternative here.

 

 

 

 

Click on the OCR tile and select the Service Task



  1. Place the service task onto the canvas next to the OCR
  2. Name the service task 'Metadata Extraction'
  3. Note: The arrow to the service task was automatically added
  4. Click on Settings of the 'Metadata Extraction'
  5. Select 'FocalPoint Invoice Extraction' from the 'Action' Dropdown List
  6. Now, the country settings are visible. Settings for the different Actions appear after the action is selected.
  7. From the 'Country' dropdown list select 'UK'.
  8. Close the service task settings by pressing the x on the top right.

Note: The list contains supported and preconfigured Invoice Processing settings.

 

The process should look like this:

 

Scripting Business Rules with Java Script

 

 

 

The ScriptTask allows you to define Java Scripts that are executed on the server side. In this tutorial step, we will use the ScriptTask to do a DB Lookup where we retrieve the SupplierCompanyName from teh TaxID we found on the invoice.

 

  1. Add a ScriptTask (either by drag and dropping the script task from the left menu or by clicking on the Metadata Extraction step and adding the script task.
  2. Name the Script task 'DB Lookup & Business Rules'
  3. Click on the Settings of the scriptTask
  4. This opens a JavaScript editor
  5. Copy the following code into the script:
//DB Lookup
var query = {
    User: 'ukinvoice ',
    Password: '4149ad2c-7659-4215-abb5-a937e7cbc202',
    SqlQuery: 'select * from ukinvoice.Supplier where TaxID = @TaxID',
    Parameters: {
        '@TaxID': SupplierTaxID
    }    
};

effektif.ajax({
    url: 'https://iconnector-configuration.cumuluspro.net/v2.2/DataService.svc/json/Query',
    data: JSON.stringify(query),
    method: 'POST'
}).done(function (stringData) {
    var data = JSON.parse(stringData);
    
    if (data.ErrorMessage) {
        _errorMessage = data.ErrorMessage;
        onwards = false;
    } else if (data.Records.length == 1) {
        SupplierCompanyName = data.Records[0].Name;
    } 
}).fail(function (jqXHR, error) {
    _errorMessage = error;
    onwards = false;
});

 

This script queries the database with the TaxID and from the returned records, it selects the first and populates the value into the SupplierCompanyName index fields. In case of an error, the error message is assigned to the _errorMessage variable and the document stays in this workflow step.

 

The process flow should now look like this:

 

User Task - Validation

 

 

 

Now that we have the metadata extracted and the business rules executed, we want a user to validate the invoice. The user should have the option to edit the index field and if the document is correct to complete the document. If the document has to be sent to the vendor, the user will reject the document for the vendor to update.

 

  1. Add a UserTask to the workflow
  2. Name the UserTask 'Validation'
  3. Draw an arrow from the 'DB Lookup & Busines Rules' to the Validation
  4. Click on the Settings of 'Validation'
  5. In Application Configuration select 'Web Validation (MyHome) from the drop down list
  6. Under 'Validation Buttons enable the 'Complete' and the 'Reject' button
  7. Close 'Validation Settings' by clicking the top right x of the dialog
Note: As Validation requires users to access documents, we will create users and roles. However, we will do that later when we created a few more steps that require user interaction.

 

The workflow should look like this:

 

Exclusive Gateway

 

 

 

In Validation, we have given the user the chance to either Complete the invoice (and move to the next step) or to reject the invoice. Hence in this next step, we want to route the document to different steps in the workflow.

1) If the document is completed, then it should move on to the Approval stage

2) If the document is rejected, we want to inform the vendor and give the vendor a chance to correct the invoice

 

An Exclusive gateway is added in the same way as a process step

  1. Drag and Drop the Exclusive gateway onto the canvas
  2. Draw an arrow from Validation to the exclusive gateway

 

Note: The routing definition from the exclusive gateway is defined in the outgoing arrow. We will cover this in the next step.

 

Script Task - Web Validation URL for Supplier

If we reject the document to the vendor, we want to inform the vendor by email that the invoice has been rejected. As part of the email, we want to include a link to the webvalidation module (and document) where the vendor can update the document.

 

  1. Drag and Drop a ScriptTask onto the canvas
  2. Name the ScriptTask to 'Create Web Validation URL for Supplier'
  3. Opent the settings for the ScriptTask
  4. Copy/Past the following code into the script task:
effektif.ajax({
    url: 'https://iconnector-configuration.cumuluspro.net/v2.0/AuthService.svc/json/TokenForFederatedAccount?' +
             'loginName=' + encodeURIComponent('supplier@invtutorial.com') + '&' + 
             'password=' + encodeURIComponent('password') + '&' +
             'customdata=' + encodeURIComponent('step=979,docid=' + _documentId),
    data: '',
    method: 'GET'
}).done(function (dataString) {
    var token = JSON.parse(dataString);
    
    RejectURL = 'https://webvalidation.cumuluspro.net?ConfigurationUniqueId=2b1c48b9-a3ea-4a13-8fa1-7772ec90d6d5&token=' + token;
}).fail(function (jqXHR, error) {
    _errorMessage = error;
    onwards = false;
});

 

The script creates a URL that points to the document with an access token. The URL is then assigned to the index field RejectURL.

 

Important: The step ID (in the sample code 979) needs to match the step ID of the web validation module. The step ID for webvalidation is the ID that is in the pop up of the UserTask. This has not yet been created and needs to be updated in the script later.

 

Now that the ScriptTask has been created, we can draw the conditional routing to that script task.

  1. Click on the Exclusive gateway
  2. Click on the arrow
  3. Draw the line to the 'Create Web Validation URL for Supplier'
  4. Click on the arrow
  5. Click on the Settings icon
  6. For the Condition Field select '_status' from the dropdown list
  7. For the 'Equals' enter 'reject'
    Note: The _status variable is assigned the value of the button clicked by the user in Web Validation. the button 'Reject' assigns the value 'reject'
  8. Close the Arrow Dialog
  9. Double Click the arrow
  10. Enter a Label description 'Reject to Supplier' and position this next to the arrow

The workflow should now look like this:

 

Email to Supplier

In the next step, we want to send the vendor an email with a link to the invoice. The vendor can then click on the link in the email to update the details to the invoice.

 

  1. Add an ServiceTask
  2. Name the task 'Email to Supplier'
  3. Draw an arrow from 'Create WEb Validation URL for Supplier' to 'Email to Supplier'
  4. Click on the Settings of the 'Email to Supplier' service task
  5. From the Action, select 'SendGrid Send Email'
  6. Enter teh details of the email. Note, To Email address can be taken from the Index field or can be a fixed email address
  7. For the body, you can either use a Text Body or HTML Body. For HTML, copy this sample HTML email:
<body> 
<p>Dear Sir/Madam,</p>

<p>An invoice that we have received from you needs your attention. Please click on the link below to review the invoice and the respective comments/questions.</p>

<p>{RejectURL}</p>

<p>Regards,
<br>The CumulusPro Team</br></p>
</body>

 

Note: The {RejectURL} is the index field value we enter here.

 

Note: If you have your own SendGrid account, you can enter the API Key in the settings. Then we will use your account. Otherwise the CumulusPro account will be used and the outgoing email will be from CumulusPro.

 

Supplier Validation and Timer

 

 

Once the email has been sent to the supplier the system will wait for the supplier to update the invoice. There are two potential outcomes.

1) The supplier does update the invoice and 'Completes' the assigned task.

2) Supplier does not take any action and hence after a certain waiting period, the invoice should be processed as an exception (Email to Supplier that the invoice has been rejected)

 

  1. Add a UserTask and name it 'Supplier'
  2. Draw an arrow from 'Email to Supplier' to 'Supplier'
  3. Draw an arrow from 'Supplier' to 'Validation'
  4. Click on the 'Supplier' UserTask Settings
  5. For 'Application Configuration' select 'Web Validation (MyHome)'
  6. For 'Validation Buttons' select 'Complete'
  7. Close the 'Supplier Settings' by clicking ont he top right x

 

Now, we add a timer function (Boundary event)

  1. Drag and Drop the Boundary event onto the Supplier UserTask on the bottom right
  2. click on the Boundary Event
  3. Click on Settings
  4. Enter '3' in the 'Days' section

 

This means that a task will wait for 3 days until action is taken. If no action is taken, the task is routed to another step.

 

Update the 'Create Web Validation URL for Supplier' with the correct ID of the 'Supplier' user task.

 

Email to Supplier - Invoice Reject

In case the supplier does not take action on the invoice within 3 days, we want to send an email to the Supplier informing the supplier about the rejection of the invoice.

 

  1. Add a ServiceTask onto the canvas next to the Boundary Event
  2. Name the ServiceTask 'Email to Supplier - Invoice Reject'
  3. Draw an arrow from the BoundaryEvent to the new ServiceTask
  4. Double Click on the Arrow and create a label 'No response within 3 days
  5. Click 'Settings' on the 'Email to Supplier - Invoice Reject' and complete the email settings similar to the previous 'Email to Supplier' task.
  6. In 'Add Attachment' select 'Original Email (EML) as the first attachment
  7. In the second 'Add Attachment' select 'Original Document'

The workflow should now look like this:

End Event

To complete the workflow, we add an end event. This are where documents are completed and after a configured time are deleted from the Straatos Platform.

 

  1. Add an EndEvent to the process next to 'Email to Supplier - Invoice Reject'
  2. Draw a line to the End Event.

 

The workflow should now look like this:

 

Approval

Having complete the exception handling where we need suppliers to update the invoice, we now need to complete the standart (default) process. For this tutorial, we would like to route the document to an approver. The approver will have the option to Complete the document.

 

  1. Add a UserTask 'Approver
  2. Draw an arrow from the Exclusive Gateway to 'Approver'
  3. For 'Approver' settings, enable the button 'Complete'
  4. For 'Application Configuration' select 'Web Validation (MyHome)'

The workflow should now look like this:

 

 

Commenting

Comment fields are an easy way to add notes to the workflow so it makes it easier to understand. For this tutorial, we add a note to the Supplier step to give an example of why a document is sent to the supplier.

  1. Click on Supplier
  2. Click on the notes icon
  3. Place the note box onto the canvas
  4. Enter a description, such as 'Missing PO Number'

 

Export to Google Drive via Zapier

In the last step, we want to export the documetns and metadata to a backend system. For this tutorial we use Zapier to export the documents to Google Drive. Zapier (www.zapier.com) provides integrations into more than 500 applications. Hence the Google Drive example is just one of many.

 

  1. Add a ServiceTask next to the 'Approver'
  2. Name the ServiceTask 'Export to Google Drive
  3. Draw an arrow from 'Approver' to the 'Export to Google Drive'
  4. Draw an arrow from 'Export to Google Drive' to the EndEvent
  5. Click on Settings on 'Export to Google Drive' and select 'Zapier Integration' from the  'Action' Dropdown

 

The remaining configuration is done within Zapier. We first complete the user and role setup and route a document past the all the steps so Zapier can automatically pick up the values to link to Google Drive.

 

User and Roles Setup

We need to create a user for each Validation step as well as a user to work with Zapier.

  1. Select 'Invoice Processing Tutorial' from the menu navigation:
     
  2. Select Authentication
  3. Select Roles
  4. Each UserTask workflow step has already a role. However, we need to create a role for 'MyHome' and 'Zapier'
  5. Click on 'Create Role'
  6. Name the role 'Zapier'
  7. Click on the tile 'Zapier'
  8. Under Functions, select 'Zapier'
  9. Click on 'Back' in the browser
  10. Click on 'Create Role'
  11. Name the Role 'MyHome'
  12. Under Functions, select 'MyHome'
  13. Lastly, lets set up a scan role
  14. Click on 'Back' in the browser
  15. Click on 'Create Role'
  16. Name the Role 'Scan'

Now we have created the roles, lets create the users

  1. Go back up to 'Authentication'
  2. Click on 'Accounts'
  3. Click on 'Create Account'
  4. Name the user 'Supplier@InvTutorial.com'
  5. click on the Tile
  6. Enter an easy to remember password
  7. Select 'Supplier' from the 'Add Role'

 

Repeat steps 3-7 for the following users/roles:

Approver@InvTutorial.com   - Approver

Validation@InvTutorial.com - Validation

Tutorial-Zapier - Zapier

Scan@InvTutorial.com - Scan

 

Now the roles have been setup

 

Testing the workflow

Publishing the workflow

Before using the workflow, we need to publish it.

  1. Goto Workflow Configuration - Invoice Process Tutorial - Design Process
  2. Click on 'Publish Workflow'

 

Upload a Document

Use either the mobile app or Scan+ProcessLite to scan and upload a document

 

Monitor the Documents

  1. Goto Workflow Configuration - Invoice Process Tutorial - Monitor Process

 

Processing Documents

Use one of the CumulusPro Clients to capture a number of invoices. In this example we use Scan+ProcessLite.

  1. Goto the Link tile:
  2. Open the Scan+ProcessLite link:
  3. If you haven't used the scan client on the machine before, you will need to install Scan+. Otherwise, you will be prompted to log in.
  4. Login with the Scan Operator credentials (alternatively, if you have configured 'Anonymous login', you will skip this step.
  5. Scan documents and upload documents:
Note: I have included an index field 'FromEmail' where I can enter the email address. This makes it possible to test the email notification.

Monitoring the Process

 

 

 

Now that the documents are uploaded, we want to monitor the progress in the Process Monitor.

  1. Open admin.cumuluspro.net
  2. Log in
  3. Goto the workflow
  4. Next to the 'Design' Button there is a 'Monitor' button. Click on the button.

 

The process Monitor opens and displayes the same representation as the Design Process.

 

If the documents are sucessfully imported, they are displayed as a number below the workflow step they are currently in:

In the above screenshot, 1 document is visible.

 

If not all document are visible, this might be that the counters have not been refreshed. The counters refresh every minute automatically. If you want to refresh the counters manually, you can do this by preccing the 'update counters' button:

To see more details of the documents in a particular step, click on the step tile. A table opens showing the details of the documents as well as actions that can be taken for those documents:

 

If you would like to see a preview of the documents, click onto the document line (not the checkbox in front) and a preview opens:

To hide the preview, click on the line again.

 

Continue to process all the documents and check the outcome in each particular step until the 'Export to Google Drive' step. Next, we will setup Zapier.

 

Zapier Configuration for Google Drive Export

For this tutorial, we going to setup zapier as an export for Google Drive.

 

  1. Goto www.zapier.com
  2. If you don't have already a login, create a new login
  3. One setup, goto 'My Zaps' and click on 'Make a New Zap'
  4. Your screen should look like this:
  5. in 'Choose a Trigger App' enter CumulusPro
  6. Select CumulusPro
  7. Then in 'Choose Trigger' click on Save+Continue'
  8. Select (or create) and account. Note, if you haven't used Zapier with this workflow yet, create a new account and log in with your organisation level account that has rights to zapier
  9. Click on Test Account and once 'Account is working' is displayed, click on 'Save+Continue'
  10. On the Set Up Options, choose the workflow and the workflow step. Note: Only workflow steps which are 'ServiceTasks' and where the Action is 'Zapier Integration' are shown.
  11. On 'Test this Step' click 'Fetch & Continue'. Important is that a document is currently in the 'Export to Google Drive' step
  12. If the test is successful, click on continue.

 

Now we setup the Action (Google Drive)

  1. Search and select 'Google Drive'
  2. Choose 'Create File from Trigger' and click Save+Continue
  3. Select your Google account or add a new one, then click Save & Continue
  4. Select the Folder (optional)
  5. In 'File', click on the list icon at the end and then select the document you want to export. In this case it is the 'Abbyy OCR searchable PDF'
  6. Click Continue
  7. Click 'Create & Continue on the 'Test Google Drive'
  8. When the 'Test Successful' appears, click on 'Finish'
  9. Create a Name for your Zap and switch it on.

 

Now the zapier setup is complete. To process the document in Admin Panel Process Monitor

  1. Select the document
  2. click on Retry selected
  3. The document now gets exported to Google Drive
  4. Check Google Drive if the documents are there

 

 

Business Rules in Web Validation

 

 

So far, we have setup business rules in Java Script as part of a process step. However, we may want to validate index information in the Validation screen. For this tutorial we add a check if the GrossTotal is equal to the NetTotal + Tax.

 

  1. Go to the Workflow setup
  2. Click on the index field 'GrossTotal'
  3. Scroll down to the 'Validation Expression Message'
  4. Add the message 'Net Total + Tax Total is not equal to Gross Total'
  5. In 'Validation Expression (boolean) enter the JavaScript: 
roundAmount(NetTotal + TaxTotal) == roundAmount(GrossTotal)

 

Now, to test, open the fly-out on the right hand side.

 

This opens the Web Validation Simulator. The Web Validation Simulator displays all the fields and rules as the web validation module. Each change that is made in the rules will immediately reflect in the simulator. Also, the index field values can be entered and tested if they fit the rules.

Create your own Knowledge Base