Klevr Product Documentation logo

Approvals

The Approval feature can be added to just about any entity.

Feature Overview

The Approval feature can be added to just about any entity. The instructions below will guide you through the process of adding an approval flow to an entity's BPF

Components

The approval functionality consists of the following components:

Approval Config record

The config record controls the approval process. On a config record you need to specify the entity that you want the approval to run on, as well as some entity field schema names that will be set by the approval process.

You can specify a fetchxml query that will be checked against the record to see if the approval applies to your selected record, thus giving you the ability to have different approval groups based on any criteria.

The config record also has an execution order, so you can have multiple lines of sequential approvals before a record is marked as approved. By creating multiple records for a single entity, and using the fetch and execution order, you can create complex approval lines with multiple steps based on your criteria.

Approval User record

The approval user record is an activity type record, and will be created once the approval is initiated. One record for each person in an approval group will be created and associated to the record being approved.

Plugins restrict a lot of functionality around this record, and ensures the users can only approve or decline their own records.

They can also select another user to delegate their approval to. This will cancel their approval record, and create a new approval record for the delegated user. This allows an approval to be delegated multiple times, but retain the history of the delegation chain. Approval admins have the ability to delegate other user's records, and have the ability to delegate another users record to themselves, and can then approve their own delegated record.

This means an approval admin can single handedly approve a record by delegating all approvals to themselves, so care should be taken in assigning this role. However, the full audit trail of their actions will be visible, and cannot be altered or deleted by them.

Ribbon Buttons

To apply the approval process to an entity, you need to apply some ribbon buttons. There are 3 important ribbon buttons:

  1. One to initiate approval. This will kick start the process.
  2. Allow a user to approve a single record from within the record itself.
  3. Allow a user to approve to approve multiple records from a list view of the entity. This button will find associated approval user records and automatically update them with the details that the user enters when clicking the approve button.

Web resources

To facilitate the buttons, there are 2 web resources:

  1. A javascript used by the buttons to run the logic for the buttons
  2. A dialog that prompts the user for approve/decline and enter a comment.

Custom API and plugins

A custom API function initiates the approval process, evaluates the approval criteria and creates the approval user records. It is also used to invoke sequential approvals once the previous approval is complete. The plugins run on the approval user records and are therefore self contained.

Notification Flows

The product contains a template flow for notification (Klevr Template - Approvals - Send notification for approval in the CRM solution), and this left up to the implementation team to duplicate and refine.

Flows should run on create of an approval user record. It looks at the regarding record type, and construct an email with relevant details from the regarding record (each record type has its own block to gather pertinent details from the regarding record).

A link to the regarding record is constructed and included in the email, so the user can open the record from the email, look at other details and click the approve ribbon button on the record to approve it.

To complete the flow, ensure all the required details are included in extraction, update the email wording where required, and add a step to send it, specifying the from queue or user defined in your implementation.

Enable Klevr Approvals on a new Table

In order to add approvals to a new table, the following needs to be configured:

Add Approval Fields

The Approval Configuration Record requires some fields to track the status of the approval for each record. It is recommended to create the following fields:

Schema NameDisplay NameTypeNote
requiresapprovalRequires Approvalbooleandefault = No
isapprovedRecord Approvedbooleandefault = No
approvaltypecodeApproval TypeGlobal optionset = Approval Typedefault = none
  • requiresapproval will be set based on whether the record meets any criteria for any of the approval config records for this table.
  • isapproved determines whether the record has actually been approved and is used as part of the BPF configuration
  • approvaltypecode (global optionset, with one must approve or all must approve). This is only for informational purposes and is coped from the approval config currently applied to this record.

Approval Config Record(s)

Create the Approval Config Record(s) according to the approval criteria. This is where you can specify FetchXML to filter the records that require approval.

User Notifications

Write or update the approval user notification flows. These are not part of the product, since notifications should be personalised based on customer needs.

Business Process Flow

Modify the Business Process Flow if required to add approval steps. You can use the isapproved boolean field to hide or show the approval step.

Business Rule

Create a business rule to lock all the approval fields for the table. This is so that a user cannot modify the values in the business process flow. They will be modified by the back-end plugins.

Plugin Step

Add a plugin step for pre-create to the klevr.feature.ApprovalEntity plugin for the table being approved.

Add the ribbon buttons to the entity

Please follow the steps below to configure ribbon buttons on your table:

  1. create a solution that contains just the table shell (no associated fields, views or forms)
  2. Open the newly created solution in Ribbon Workbench ⚠️ it isn't possible to configure these buttons using the Maker portal as javascript web resources can't be attached to visibility rules.
  3. Add three buttons in the desired locations on the various ribbons: RequestApproval request approval on the form ribbon Approve single record on the form ribbon ApproveMulti to approve on the home/list toolbar (for views of the table, allows users to multiselect records for approval).

Add the ribbon buttons to the entity (1)

Add the ribbon buttons to the entity (1)
  1. Name the buttons Approve, ApproveMulti and RequestApproval, and create commands and enable rules for each:

Add the ribbon buttons to the entity (2)

Add the ribbon buttons to the entity (2)

For the commands, create custom javascript actions, and add the following parameters:

  • RequestApproval:
    • Function Name: KlevrCommon.RequestApprovalClick

Add the ribbon buttons to the entity (3)

Add the ribbon buttons to the entity (3)
  • Approve:
    • Function Name: KlevrCommon.ApprovalClick

Add the ribbon buttons to the entity (4)

Add the ribbon buttons to the entity (4)
  • ApproveMulti:
    • Function Name: KlevrCommon.ApprovalMultiClick

Add the ribbon buttons to the entity (5)

Add the ribbon buttons to the entity (5)

For the enabled rules, create custom rules and link them to the klevr_approval.ribbon.js webresource:

  • RequestApproval:
    • Function Name: KlevrCommon.RequestApprovalVisible

Add the ribbon buttons to the entity (6)

Add the ribbon buttons to the entity (6)
  • Approve:
    • Function Name: KlevrCommon.ApprovalVisible

Add the ribbon buttons to the entity (7)

Add the ribbon buttons to the entity (7)
  • ApproveMulti:
    • Function Name: KlevrCommon.GetApprovalMultiRecords

Add the ribbon buttons to the entity (8)

Add the ribbon buttons to the entity (8)

5 Add these images:

  • Approve Button: ClickToCall/SuccessX16.svg
  • Multi Approve Button: ClickToCall/SuccessX16.svg
  • Request Approval Button: /HeaderIconImages/TeamManagement.svg
  • Publish the solution and verify the buttons are working.

Last updated on