Extensions > Custom extensions / Activities in custom extensions

Activities in custom extensions

Business process activity is an operation performed at a specific business process step. It looks and behaves like a BPMN graphic element. The user can drag it to the diagram and configure it like other elements of the business process. Business process activities are needed to implement complex conditional logic. They can execute your custom scripts or call a process created as a part of an extension.

The configured activity element will be available in the Business Process Designer, on the toolbar, on the Integrations tab. It can be used multiple times in different processes.

 

To set up a business process activity:

  1. Go to Administration > Extensions.
  2. Hover the mouse over the extension and click the gear icon.
  3. Go to the Business process activities tab.
  4. Click +Activity and enter the information in the window that opens.

Add BP activity

  • Name.* The name of the business process activity;
  • Code.* An unique identifier required to use the business process activity in business processes;
  • Type. Select the type of business process activity:
    • Script. A script that will be executed at a certain step in the business process;
    • Call process. A business process created on the Processes tab as part of an extension will be started.

 

Click Save to go to the business process activity settings.

 

Script

You can use this type of business process activity to create integrations, for example, to send requests to an external system. Business process activity settings break into three tabs: Settings, Context, Scripts.

 

Settings tab

extention-activities-2

On the Settings tab, specify:

  • Title. The name of the business process activity.
  • The default name. The name is displayed on the business process activity element when it is added to the business process diagram.
  • Element color. The color of the business process activity element on the diagram.
  • Description. A description of the business process activity functionality and features.
  • Process. From the drop-down list, select the extension process to which you want to bind the specified business process activity.
  • Update to the latest version of the process. Use this button if you have changed the list of input or output process variables. If no, there is no need to update the process;
  • Outdated. Check this option if you want to be alerted that the business process activity is outdated upon extension update. After that, it will no longer be displayed on the elements panel in the Business Process Designer. You will not be able to use the outdated element in new process diagrams. However, outdated business process activities will continue to work as usual in previously created processes;
  • Execution model. Specify the behavior of business process activity:
    • Synchronous. It means a simple execution of the script specified in the business process activity (synchronous execution of the action function).
    • Result request. It means that the system will execute the specified script and send a request to an external service to find out the status. To implement this approach in business process activity, you need to define the check function that checks the result. It should be called at a specified frequency. The business process will continue after the check function returns true.
    • Callback. It means that the url, to which the result must be returned, is passed as part of a call to an external service. That is, the url is included in call parameters. This url will be called by the external service after the task is completed. Results of the call will be sent to this url. The response url is provided as an input argument to the action function. Any request for this url is passed to the callback function. After that, the process will continue.
  • Number of retries in case of error. Specifies how many times the system should try to execute the business process activity.
  • Retry delay (sec)* Defines the frequency of attempts.

 

 

Context tab

On the Context tab, you can add variables to use in the business process activity. After adding the business process activity to the process diagram, you can map these variables to the process context.

To create a new context variable, click +Add. Read more about variable types in the article "System Data Types."

extention-activities-3

Check whether the variable is input, output, or required.

  • Input parameters are the parameters that are filled in before the execution of the business process activity. You can use them to pass the values of context variables of the process that contains specified business process activity.
  • Output parameters are the parameters that are filled after the business process activity is completed. Output parameters can be passed to the context of the process that contains the specified business process activity or directly to the fields of the app. The mapped variables must be of the same type.

You can also configure a custom mapping form for specified business process activity using widgets. To do this, click the Create Form button. Attention: Once you create the custom form, it will be impossible to switch back to the standard form. The system will warn you about this, and you can either continue or cancel creating the form.

BP Activtiy binding form

Click OK to go to the Interface Designer, where you can create the form.

After creating the form, in Business Process Designer, you will see the Settings tab instead of Input and Output parameters in the business process activity settings. It will display the form that you have set up earlier.

 

Scripts tab

On the Scripts tab, you can create a business process activity script. Scripts are written in the TypeScript programming language. If you'd like to know more about the basic principles of scrip-writing in ELMA365 , please visit TypeScript SDK Help Center.

You can use the Global constant  in API methods to access variables inside workspaces and global parameters.  Using this constant limits further extension export. It means that if you enable access to the Global constant in API methods you will not be able to export the extension later on.

To allow access to the Global constant, click Settings in the menu at the top of the page. In the window that opens, check the Global checkbox.

Add BP activity script

Once you have specified all the required settings, save and publish the activity. The business process activity is ready for use. It will be available in the Business Process Designer, on the Integrations tab of the panel to the right of the modeling area.

 

Call process

 

This type of business process activity allows you to call the process configured on the Processes tab of the extension.

 

Settings tab

 

extention-activities-6

On the Settings tab, you need to specify:

  • Name. The name of the business process activity;
  • The default name. The name that is displayed on the business process activity element when it is added to the business process diagram.
  • Activity color. The color of the business process activity element on the diagram.
  • Description. A description of the functionality and features of the business process activity;
  • Process. From the drop-down list, select the extension process to which you want to bind specified business process activity.
  • Update to the latest version of the process. Use this button if you have changed the list of input or output process variables. If no, there is no need to update the process;
  • Outdated. Check this option to mark the business process activity as outdated when you update the extension. After that, it will no longer be displayed on the elements panel in the Business Process Designer. You will not be able to use the outdated element in new process diagrams. However, outdated business process activities will continue to work as usual in previously created processes;
  • Message if the activity is outdated. A text of a warning message that the business process contains outdated business process activity. This message will be displayed if a user publishes a process that contains outdated business process activities of a particular extension;
  • Number of retries in case of error. Specifies how many times the system should try to execute the business process activity.
  • Retry delay (sec) * Defines the frequency of attempts.

 

Context tab

The context variables of the business process selected in the Settings tab are displayed here. Check whether the variable is input, output, or required.

  • Input parameters are the parameters that are filled in before the execution of the business process activity. You can use them to pass the values of context variables of the process that contains specified business process activity.
  • Output parameters are the parameters that are filled after the business process activity is completed. Output parameters can be passed to the context of the process that contains the specified business process activity or directly to the fields of the app. The mapped variables must be of the same type.

Once you have specified all the required settings, save and publish the activity. The business process activity is ready to use. It will be available in the Business Process Designer, on the Integrations tab of the panel to the right of the modeling sheet.

 

How to use business process activities

Once the extension is enabled, you can add its business process activities to business process diagrams. In doing so, it is necessary to take into account a number of features.

 

Escalation

For custom activities, be sure to add an escalation transition. This way, you avoid getting an error in the business process execution if the extension is disabled.

To set up escalation, double-click on a corresponding element on the flow chart diagram. Click the Error handling tab.

extention-activities-7

  • Notify users on error. Select this option if you want ELMA365 to notify the responsible users in case of an error. Click the +Add button below the option. In the window that opens specify these users, for example, the current user, a context variable such as an initiator, a group, or an org chart item. Please note that the current user is the person who completed the task thatd stands just before the business process activity on the process diagram.
  • Interrupt. When this option is checked, once getting an error, the system will stop trying to execute the business process activity and will direct the process along the selected transition.

 

Mapping the context of a business process activity and a business process

The context of a business process activity can be mapped to the context of the process in which it is used. In this case, the output parameters can be passed both to process variables and directly to the fields of any app that is added to the process context.

To configure mapping settings, double-click on the business process activity element on the diagram. On the General tab, in the Bind output attributes to the field, select the option you want.

extention-activities-8

  • Process context. The values of the output parameters of the business process activity can be assigned to the context variables of the business process.
  • App. The values of the output attributes of the business process activity can be assigned to the fields of the application added to the business process context.
  • Variable. In the process context, select the app to which the output attributes of the business process activity will be mapped.

Click the Inputs and outputs tab. Map the context of an activity to a process or application. The mapped variables must be of the same type. Column matching is provided for tables. If you have configured your own binding form, it will be displayed instead of the Inputs and outputs tab.

 

Activity of Call process type vs Start Process activity

Call Process and Start Process  activities are similar, but there are a number of differences between them. They are shown in the table below.

 

 

Call process

 

custom activity

Start Process

 

system activity

Tracked in Process Monitor

No

Yes

The history of each step is available to users

No

Yes


No

Yes

Asynchronous start

No

 

The transition to the next step of the business process is possible only after the business process activity of the Call process type is completed.

Yes

 

You can continue running the main process without waiting for the subprocess to finish.

Display

Activity does not appear in the list of processes in the Administration workspace. You cannot start it directly in the ELMA365 interface by clicking the Start Process button. It can be executed only by an activity of the Call process type

Independent business process. Displayed in Administration > Business Processes.

Business process activity update

When an extension is updated, business process activities may also be updated. You will not be able to use the outdated elements on new process diagrams. They will no longer appear on the right panel of Business process designer. However, outdated business process activities will continue to work as usual in previously created processes. When you modify the logic of such a process, for instance, change its participant, upon publication of the process, you will see a warning that the process contains outdated elements.