A110 – Create a specific action

What you will learn ?

How to add a specific action on a business object

STEP 1: Create a calculated field


  • A customer score cliScore read-only field should be added to the AppClient object.
  • This field will be filled with specific code of an action of the object.


  • Open AppClient object.
  • Click on Add a field and follow the steps of the wizard

STEP 2: Create a field

Use the wizard to create the field:

  • Logical Name = cliScore
  • Physical name = cli_score
  • type integer length 10
  • Read-only (it will be a calculated field by the code of the action)
  • No functional key and not required
  • Always Visible

STEP 3: Follow the wizard to create a field

In the following steps:

  • Enter the AppClient-1 area of the form, in position 200
  • Translate to Score

STEP 4: Create an action

  • Open the Administration menu
  • Click on Action to display the search action form
  • Search the action or create a new one


  • click on Create to define a new action.

STEP 5: Configure the action


  • Name: for example prefix with the name of the object and a qualifier for the action
  • Type: it is the display type, it can be Hidden or Enable on list (action on all records of the current search) and / or in the object form.
  • AsynchronousSynchronous (blocking the user) or Asynchronous (to give the hand to the user if the action is long)
  • Async jobs depth : Indicate the depth of log traces. if the number is positive it is in quantity, if the number is negative it is in rolling days.
  • Method: a method name coded in each object that will use the action
  • Processing expression: a JavaScript expression (the script will be interpreted on the fly during the use of the action)
  • URL: Path to a redirect page (ex. SYS_work.jsp, ALL_form.jsp or any http), or to a specific page (JSP or servlet) coding in the project or JavaScript code (in this case prefix the URL with JavaScript:)
  • Enter an Image URL to represent the action, if none the action will be displayed as a button
  • Indicate whether the action must be confirmed by the user
  • If it is displayed in the Plus menu
  • Select the module


Create the action that will calculate the customer score by script:

  • Name = AppClient-Score
  • Enable on form only
  • Synchronous
  • Without confirmation from the user
  • With the following JavaScript in Processing expression:
     var clientId = obj.getRowId();
     var score=0;
     var o = obj.getGrant().getTmpObject("AppClientInteret");
     var rows = o.search();
     for (var i = 0; i < rows.size(); i++) {
       score = score+o.getField("cintInteretFK.intScore").getInt(0);

    Explanation of the script line by line:

  • Found the customer row_id on which the action is called
  • Defines a SQL query that calculate the sum of the customer score
  • Run the query
  • Set the cliScore value
  • Save the customer

STEP 6: Translate the action

In the Translation tab, it is necessary to translate the action in all languages to display a button or a tooltip on the icon of the action.


  • Translate the English action by Calculate the score

STEP 7: Create a function

To enable an action, you must first define a function that will make the relation between the object and the action:

  • Go to the Function tab
  • Click on Create


Fill in the form of the function:

  • Give a name to the function: by convention we use the same name as the action
  • Select the object that will carry the action (so we can create several functions using the same action for different objects)
  • Select the function type = Action
  • Select the module Save.


Create a function on the action AppClient-Score-A

STEP 9: Grant the function

Finally, like any function, grant it to rights groups


  • Grant the function to MyAdminGroup

STEP 10: Clear cache

To enable action on the object, clear the cache of the platform.

STEP 11: Test the action

Open the object containing the action and check that it performs well what is set.


  • Open a customer who has interests
  • Check that the total calculation works by clicking on the button Calculate score
    If action is not visible is that the user is not in a group granted to the function of the action.
    If the calculation does not work, look out for the logs and fix the code.
    Remember to clear the cache at each update.

A100 – Create a field type

Create an external field type.

A120 – Historize a business object

Historize a business object.