Skip to content

Cloud Extensibility Tutorial

josemaia edited this page Apr 4, 2017 · 13 revisions

Introduction

This tutorial is designed to add an IBAN (International Bank Account Number) field to an Agent entity on the platform, and add a script written in C# that validates that number, as a sample of what the cloud-side extensibility can be used for.

This tutorial will drive you to explore the Extensibility possibilities in the OMNIA platform besides the on-premises scripts.

Prerequisites

This tutorial assumes that you have created a tenant based on the OMNIA Modeling Template, and are using a user with modeling privileges (preferably not the subscription's master account) to access this tenant. See this page to assist in tenant creation.

This tutorial also requires an understanding of the concepts driving the platform, which are described in this page.

If you are performing this tutorial on top of a tenant that was already used to execute a previous tutorial, when there is an instruction to create an Entity and then perform further operations on that entity, if you already created one with the given name, you can reuse the one that already exists.

Download the C# Scripts files that can be found in this tutorial's folder:

  1. Validate IBAN that will be used to validate the input data provided by the user.

We would like to invite you to open the C# Scripts and see that this is simple C#, that you can adjust to meet your needs. If you want to know more about OMNIA Scripting Extensibility and how you can use Visual Studio to script development, please take a look at the Scripting chapter from the Modeling Manual.

Adding an IBAN

  1. Start by accessing the Modeler.

    1.1. Open the left-side context menu (click in arrow next to the name of the tenant you are currently on).

    1.2. Choose the option Modeler.

  2. Through the top navigation menu, access Entities > Agents. Create an Agent Type (Add new button in the context options in the bottom of the screen), and set its Code and Name to "Customer".

  1. Add an Attribute to Customer, under General, with the Code and Name of IBAN, of type Text.

  2. Save the Customer Agent, via the context option in the bottom of the screen.

  3. Access External > Systems in the menu, and create an external system called ExternalSystem. This will not be used directly, but is necessary for script creation.

  4. Access Entities > Agents > Resources in the menu, and open the context menu for the resource Customer.

  5. Access Configure Scripts, and, within it, use Add New to create an Extensibility Script named Validate IBAN with the following configuration:

    • External System: ExternalSystem

    • Action: Attribute Action

    • Files: Upload the ValidateIBAN.cs file, set to Cloud execution.

  1. Save the Extensibility Script.

  2. Access Entities > Agents, and edit the agent Customer. Edit the IBAN attribute, and add to it a Triggered Action with the following configuration:

  • Type: Execute a blocking script

  • Script: ValidateIBAN

  • Executed on: Change

  1. Confirm the changes to the attribute using the Accept button

  2. Save the changes.

  3. Access the application. Go to Configurations > Customer > Create and access the customer creation form.

  4. Place an invalid IBAN. Verify the platform gives you a warning. (The first execution of the script will take a little longer than subsequent ones.)

  1. Place a valid IBAN (for example, you can try one of the following: PT50123443211234567890172, GB29NWBK60161331926819, ES9121000418450200051332, FR1420041010050500013M02606). The platform lets you save as normal.

Next Steps

The next tutorial in our order is the Web Components Tutorial, which covers the same case, of validating an IBAN, but also shows how to alter the UI in order for the input of that IBAN to be more natural to users.

Clone this wiki locally