Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

User interface (UI) actions are buttons, links, and context menu items on forms and lists. They allow customizing you to customize the UI to be more interactive, adjustable, and comfortable for working.

Tip

Role required: admin.

UI action

inheritance and override

In SimpleOne, you can inherit the UI actions and then override their logic, scripts, order, name, or any other feature.

Inheritance rules

  1. The following UI actions are applied to forms and lists:
    • UT actions inherited and not overridden by the Overrides by option on the current level of inheritance.
    • The functionality overridden on the current level of the UI actions inheritance.
    • UI actions specified on the current level.
  2. UI action inherited on the 1st level with functionality overriding specified on the 2nd level cannot be applied on the 3rd level of inheritance. An inherited UI action specified on the 2nd level may be applied to the 3rd one.
  3. UI action inherited on the 1st level with the functionality overriding specified on the 3nd level cannot be overridden on the 2nd level. In this case, the system warns of active override option and requires for its deactivation.
Info

The system provides UI Actions inheritance with the Inherits option. When a UI action has a Table attribute specified, and the Inherits option is enabled, the system applies this UI action to all children tables of the one specified before. 

To child UI actions, the reference Parent option defines an ancestor UI action with functionality options may be overridden if needed.

To inherit a UI action, complete the steps below:

  1. Make a UI action parent by setting the Inherits checkbox active and clicking Save.
  2. Make a UI action child by specifying the Parent field with the UI action you want, then customizing the record.
  3. Click Save or Save and Exit to apply changes.

To override a UI action, complete the steps below:

  1. Open the child UI Action form.
  2. In the Overrides by field, specify a parent UI Action that should be overridden.
UI actions

types

  1. On forms:
    • Header Leftleft
    • Header Rightright
    • Hamburger MenuBurger menu
    • Field Label Context Menulabel context menu
    • Link
    • Bottom
  2. On lists:
    • Header Leftleft
    • Header Rightright
    • Hamburger MenuBurger menu
    • Column Header Context Menuheader context menu
    • Row Context Menucontext menu
    • Link
    • Bottom
  3. Other:
    • Button Context Menucontext menu
    • Dependency Map Context Menumap context menu

UI actions on form


Image RemovedImage Added


UI actions on list


Image RemovedImage Added

Customize UI actions

customizing

You can create new or customize existing UI actions.

To do thisso, please complete the following steps:

  1. Navigate to System Definitions → UI Actions.
  2. Click New or select an existing UI-action.
  3. Customize UI-action using the form provided.
  4. Click Save or Save and Exit to apply changes.
Tip

You can edit some types of UI actions like buttons, links in a quick way. For this, please complete the steps below:

  1. Right-click on the UI action you need to edit to open a context menu.
  2. Click Edit UI action. The specified UI action form appears.

Image Removed

Global UI Actions

You can make a UI action display on all tables.

To do that, follow the steps below:

  1. Open the UI action record desired.
  2. On the form, specify Global table in the Table field.
  3. Click Save or Save and Exit to apply changes.
Info

Most hamburger menu items and some buttons on forms (New, Save, Save and Exit) and on lists (New, Delete) are global.

Embed a UI Action

UI action functionality allows creating multi-level submenu options by embedding items for the hamburger menu within forms and lists. 

Note

This option is only available for UI actions of the Hamburger Menu type.

To embed a UI action, follow the steps below:

  1. Create a parent UI action specifying its type with the Hamburger Menu checkboxes in the Form Style or List Style lanes on the Position and Style tab.
  2. Click Save and Exit to leave the form.
  3. Create a child UI action of the same type specifying its Parent option with UI action created before.
  4. (Optional) Set the Inherits option active.
  5. Click Save to apply changes.

Display condition configuration

The condition optiondefines situations when UI actions displayed. The Condition field expects using server-side API, but in some cases, it is possible to apply client-side API. To enable client script use, on the UI action form, set the Client option checked. Within Condition, to access a UI action, use the current object. This object may be used only for UI actions displayed on forms. 
  1. exit to apply the changes.

UI

Info

It makes sense to invoke current within UI actions on updating since this object is defined in this situation. When creating a new UI action, the current value is NULL.

Use logical operators && (AND) and || (OR) for making up the complex conditional expressions.

Condition option allows invoking server-side Script Includes created. In the example below, the function wfContextExists() of Script Include with the same name gets current.sys_id and current.getTableName as recordID and tableName arguments.

Image Removed

Info

The ss object allows invoking the SimpleSystem methods.

This UI action is a reference to the record with the sys_id of the getTableName table. If a record exists, the function returns TRUE, and, in the opposite, it returns FALSE when there is no record found. Depending on the value returned, the function displays the UI action or not.

Code Block
languagejs
titleFunction definition
linenumberstrue
function wfContextExists(recordID, tableName){
  const table = new SimpleRecord('sys_db_table');
  table.get('name', tableName);
  const wfContext = new SimpleRecord('wf_context');
  wfContext.addQuery('related_record_id', ss.getDocIdByIds(table.sys_id, recordID));
  wfContext.selectAttributes('sys_id');
  wfContext.query();
  return (wfContext.getRowCount() > 0)
}

Defining UI action behavior with a script

The Script field defines the UI action behavior.  By default, this field supports the Server-Side API. Select the Client checkbox to switch the available API to the Client-Side API.

For example, this UI action adds an informational message with the Description field content:

Code Block
languagejs
themeEclipse
titleUI action
linenumberstrue
ss.addInfoMessage(current.description);
Info

When the current object is invoked there, it is not necessary to use the initialize() method; the object context is already initiated.

UI

Action form fields

FieldMandatoryDescription
NameYSpecify a UI action name.
It specifies a
This text is displayed on the button, link, or as a context menu item.
TableY
A
Specify a table to display UI action on.
A form or a list or a context menu should be used.
 
ParentNSpecify the context menu item to be a parent for the current UI action (applicable for the
Hamburger
Burger Menu UI action type).
CommentsN
UI action
Type a brief description of the action.
ActiveN
Mark
Select this checkbox to display the UI
-
action
is displayed
on the form (list, context menu).
InheritsNSelect this checkbox to make this UI action available
on
for all
the
child tables
child for
of the table specified in the Table field.
OrderN
The
Specify the order of the displaying
order
. If there are
over one
UI
-
actions of the same type,
then
they
will be
are arranged in the ascending order.
Overrides byN
This field specifies

Specify a UI action

, which

that will be overridden by the current UI action.

Info

Learn more about UI action inheritance and override.


Conditions and Actions
Show
Insert
insertNSelect this checkbox to display this UI action on a new record form.
Show
Update
updateNSelect this checkbox to display this UI action on an existing record form.
Wait
Server Response
server responseN

Select this checkbox to specify that the system should wait for the server response after

clicking

the button

. The button is disabled

is clicked. All the buttons with this setting on the page become inactive until the server responds.

ClientNSelect this checkbox to specify that this UI action
executes
is only performed on the client side (in the user's browser).
ConditionN
A
Specify a condition
written
using server-side API. If this condition is
be
met, then
the Script will be executed
the button is displayed on the page.
ScriptN
The
Specify a script that
will be
is executed by clicking the UI action.
URLN
This URL will be followed

Specify a URL that is displayed after clicking the UI action. You can use variables listed below

there

:

VariableDescription
{CURRENT_TABLE}The name of the current table
on the record of which the
whose records contain the UI action
is located
.
{CURRENT_ID}ID of the current record on which the UI action
was
is called.
{CURRENT_FORM_VIEW}The name of the form view
name
on which the UI action
was
is called.
{CURRENT_RELATED_LIST_VIEW}The name of the related list view
name
on which the UI action
was
is called.
{CURRENT_TABLE_ID}ID of the table
which
that is the current one for the UI action.
{CURRENT_LIST_VIEW}The
list view
name
for
of the list view on which the UI action
was
is called.
{LIST_TABLE_NAME}

The table name for the list displayed

in

on the current page.

If the current page path is /list,

then this

the variable value equals to

the 

the {CURRENT_TABLE} variable value. If the current page path is /record,

then this

the variable value contains the name of

the active

the active related list.

{LIST_TABLE_ID}

The table ID for the list displayed

in

on the current page.

If the current page path is /list, then this variable value equals to the {CURRENT_TABLE_ID} variable value. If the current page path is /record, then this variable value contains the name of the active related list.

{RELATED_COLUMN_NAME}This variable returns column name containing the referenced table ID.
{RELATED_LIST_ELEMENT_ID}This variable returns the active related list element ID.
{CURRENT_RELATED_ID}This variable returns the current related record ID.
{CURRENT_FORM_ID}This variable returns the current form view ID.


Position and Style
Use forN

In this block of fields,

choose

select the options defining where this UI action should be displayed. Available options are:

List type:

  • Lists+Related Lists – this UI action should be displayed on both lists and related lists.
  • Lists this UI action should be displayed on lists only.
  • Related Lists this UI action should be displayed on related lists only.

If Lists+Related Lists or Related Lists options are selected, then a set of checkboxes

set

appears where you can define on which related list types this UI action can be displayed. You can select more than one option.

These options display relation types between the related list elements and the parent table.

For example: the User Criteria related list contains the Users field of the List type. This field is related with the Users (user) table, so this related field is of the List field type.

By selecting and unselecting appropriate checkboxes, you can place the UI action you are creating on the related list of the corresponding type.

Option

Example

Reference field typeChild Categories related list on Menu Categories record form.
List field typeIndicator related list on Agreement record form.
Document ID field typeScript Log related list on Script form.
Scripted listTranslations related list on Column record form.
M2M typeUser Group, User Roles related lists on User record form.


Form buttons
Form
Style
styleN


Column
width60%

The style of buttons on the form view. Available options:

  • Unstyled
  • Primary
  • Positive
  • Negative
  • Secondary
.


Column

Image Modified


Header
Left
leftN
Button
Select the checkbox to display the button in the form header on the left.
Header
Right
rightN
Button
Select the checkbox to display the button in the form header on the right.
Hamburger Menu
Burger menuN
Context
Select the checkbox to display the action as the context menu item on the form.
Field
Label Context Menu
label context menuN
An
Select the checkbox to display the an item of the context menu for the fields on the form.
LinkN
Link
Select the checkbox to display the link on the form.
BottomN
Button
Select the checkbox to display the button at the bottom of the form.
List Buttons
List
Style
styleN


Column
width60%

The style of buttons on the form view. Available options:

  • Unstyled
  • Primary
  • Positive
  • Negative
  • Secondary.


Column

Image Modified


Header
Left
leftN
Button
Select the checkbox to display the button in the list header on the left.
Header
Right
rightN
Button
Select the checkbox to display the button in the list header on the right.
Hamburger Menu
Burger menuN
A hamburger
Select the checkbox to display the action as a burger menu item on the list.
Column
Header Context Menu
header context menuN
A
Select the checkbox to display the action as a context menu item for the elements of the list.
Row
Context Menu
сontext menuN
Context
Select the checkbox to display the action as a context menu item on the list.
LinkN
Link
Select the checkbox to display the action as a link on the bottom of the list.
BottomN
Button
Select the checkbox to display the button at the bottom of the list.
Button
Context Menu
context menuN
A
Select the checkbox to display the action as a context menu item for UI actions of the button type.
Dependency
Map Context Menu
map context menuN
Menu
Select the checkbox to display the action as a menu item on the service model form.

UI action scripting

Within UI action script, you can use some specific global methods allows expanding interaction possibilities. Use them to extend standard UI action functionality.

Example 1

When using the Wait Server Response option, you define to wait for the server response after clicking the button. All this time, between button clicking and server responding, the button will be displayed disabled.

In this case, use the __resolveServerResponse() and __rejectServerResponse() methodsto make the UI action available again after the action is taken. For example:


Tip

You can edit some types of the UI actions like buttons and links in a quick way. To do so, complete the steps below:

  1. Right-click the UI action you need to edit to open a context menu.
  2. Click Edit UI action. The UI action form appears.

Image Added

Global UI actions


You can make a UI action displayed on all tables.

To do that, follow the steps below:

  1. Open the UI action record desired.
  2. On the form, specify the Global table in the Table field.
  3. Click Save or Save and exit to apply the changes.
Info

Most burger menu items and some buttons on the forms (New, Save, Save and exit) and lists (New, Delete) are global.

Embed a UI action


The UI action functionality allows you to create multi-level submenu options by embedding items to the burger menu within the forms and lists. 

Note

This option is only available for the UI actions of the Burger menu type.

To embed a UI action, follow the steps below:

  1. Create a parent UI action, specify its type with the Burger menu checkbox in the Form style or List style area of the Position and Style tab.
  2. Click Save and exit to leave the form.
  3. Create a child UI action of the same type specifying its Parent option with the UI action created before.
  4. (optional) Select the Inherits checkbox to enable the UI action on the child tables.
  5. Click Save to apply the changes.

Display condition configuration


The condition optiondefines the situations when UI actions displayed. By default, this field supports the server-side API. Select the Client checkbox to switch the available API to the client-side API. In the Condition field, use the current object of the certain record to access a UI action. This object can only be used for the UI actions that are displayed on forms. 

Info

Call the current object within the UI actions during the update since this object is defined. When creating a new UI action, the current value is null.

Use logical operators && (AND) and || (OR) to compose the complex conditions.

Use conditions to call the created Script Include on the server-side. In the example below, the function wfContextExists() of Script Include with the same name gets current.sys_id and current.getTableName as recordID and tableName arguments.

Image Added


Info

Use the ss object to call the SimpleSystem methods.

This UI action is a reference to the record with the IDof the getTableName table. If a record exists, the function returns true, and it returns false when there is no record found. Depending on the value returned, the function displays the UI action or not.

Code Block
languagejs
titleExample
linenumberstrue
function wfContextExists(recordID, tableName){
  const table = new SimpleRecord('sys_db_table');
  table.get('name', tableName);
  const wfContext = new SimpleRecord('wf_context');
  wfContext.addQuery('related_record_id', ss.getDocIdByIds(table.sys_id, recordID));
  wfContext.selectAttributes('sys_id');
  wfContext.query();
  return (wfContext.getRowCount() > 0)
}

Define a UI action behavior with a script


The Script field defines the UI action behavior. By default, this field supports the server-side API. Select the Client checkbox to switch the available API to the client-side API.

For example, this UI action adds an informational message with the Description field content:

Code Block
languagejs
themeEclipse
titleUI action
linenumberstrue
ss.addInfoMessage(current.description);


Info

When the current object is called, it is not necessary to use the initialize() method; the object context is already initiated.

Code Block
languagejs
themeEclipse
title__resolveServerResponse()
linenumberstrue
await s_i18n.getMessage('The report has been saved', (response) => {
  s_form.addInfoMessage(response);
  __resolveServerResponse();
});

Calling the __resolveServerResponse() method in your UI actions allows to force the server respond, so, for example, you will not have to wait until a button becomes available.

The __rejectServerResponse() methodcan be used for error handling as shown below.
Code Block
languagejs
themeEclipse
title__rejectServerResponse()
linenumberstrue
const table = s_list.getTablesName()[0];
const selectedRows = s_list.getCheckedRow(table);
if (!selectedRows.length) {
  await s_i18n.getMessage("No selected rows.", (translationResponse) => {
    alert(translationResponse);
  });
  __rejectServerResponse();
}

Example 2

The currentCell property is used on lists and provides service information about current table cell. Information is provided formatted as an object containing cell information. 

Code Block
languagejs
themeEclipse
titlecurrentCell
const rowRecordId = window.currentCell.recordId;
const rowTableName = window.currentCell.tableName;
if (rowRecordId) {
  s_go.open(`/record/${rowTableName}/${rowRecordId}`);
}
Note

This property is available to use only on UI actions implementing Row Context Menu. To use it for the specified UI action, please navigate to its record form within the UI actions (sys_ui_action) dictionary, open the record and select this checkbox first on the Position and Style tab. After all changes, save the page.

To get this information manually, please complete the steps below:

  1. Open any list containing any values.
  2. Open developer console in your browser.
  3. Right-click on any cell to get a context menu.
  4. In the developer console, type window.currentCell and submit.
FieldDescriptionattribute

A type of an item from which information is gathered.

When a cell in list header is selected, then this field is populated with the value similar as the fieldName field.

columnIdID of the column to which the specified field is related.columnTypeType of the column to which the specified field is related.recordIdID of the record.tableIdID of the table containing specified field and record.tableNameSystem name of the table containing specified field and record.valueCurrent cell value.

Example 3

In this example, we consider a case of bulk deletion of records that were selected on the list view.

For this, a currents object is used. It is intended to store selected records as SimpleRecord objects. This object can be used instead of the getCheckedRow() method on the server side. It is available for the server-side list UI actions.

The UI action code example is listed below:

Code Block
languagejs
themeEclipse
titleDelete Selected Records
linenumberstrue
if (currents.length) { const record = new SimpleRecord(currents[0].getTableName()); record.addQuery('sys_id', 'in', currents.map(checkedRow => checkedRow.sys_id)); record.selectAttributes(['sys_id']); record.query(); record.deleteMultiple(); ss.setRedirect(); // reload window } else { ss.addErrorMessage('No selected rows.'); }


Table of Contents
absoluteUrltrue
classfixedPosition