1. Concepts
  2. Template Inheritance

Concepts

Template Inheritance

How template inheritance and overriding actions works in Stubber

Overview

Template inheritance is a powerful feature of the Stubber Framework that allows abstracting common functionality into a base template and then overriding that functionality in a child template. This is useful for creating a base template that can be used across multiple processes and then overriding the actions in the child template to customize the behavior for each process.

Understanding template inheritance is also needed to understand how to redefine actions in a template.

Inheritance

Tree Structure

All templates are merged from the _adam template in which all the standard Stubber actions are defined.

The standard Stubber templates are merged in the following order:

Template Parent Description
_adam - The base template that all other templates are merged from
_eve _adam The system template for system use per org
_org _eve The system template where orgs can define their own common functionality
[standard] _org The standard template that all other templates are merged from

Conceptually this can be represented as follows.

Template Inheritance

Inherited Functionality

When a template is merged from a parent template it inherits all the functionality of the parent template.

Conceptually this can be represented as follows. inherited functionality

Overriding Functionality

When a template is merged from a parent template it can override the functionality of the parent template.
This can be in the form of adding fields or tasks to an existing action for example.

override functionality

Examples of functionality you might want to override are:

see more below.

Top Layer Functionality

The last template in the merge chain is the standard template. It can in turn be used by other templates as a parent template if so desired.

top_layer_functionality

Redefining Actions

Most of the time you will want to redefine base actions in a template.
This is done by adding the action to the template and then redefining the action in the template.

Redefining a Base Action

To redefine a base action you need to add the action to the template and then redefine the action in the template.

By Example :
To make the _update action to send an email everytime someone posts an update to the stub.

Procedure :

  1. Add a _update action to the template flow override add update
  2. Add a notification to the _update action that sends an email override update on canvas
  3. Test the action by creating a draft stub from the template and running the _update action on the stub. override update run