Constants

Overview

A constant is a literal value that can be called from any expression, so it can be reused across multiple objects throughout the system.

Each time you modify and save a constant, a new version is created. All expressions that use the constant use the latest version. All versions are accessible to designers who can view the constant, and a constant can be reverted back to a previous version at any time.

Properties

Each constant has the following properties:

Property Name Description
Name The name that is used when executing the constant. Names are case-insensitive and must be unique across interfaces, integrations, expression rules, query rules, constants, and functions. Names cannot be changed after creation.
Description Supplemental information about the constant that is displayed in the inline help within the expression editor and the application contents grid.
Type The type of the constant.
Array Constants can either be a single value or an array of values.
Value The value that is returned when the constant is called.
Environment Specific When enabled, the constant's value is not updated on import unless set via an import customization file. This is to prevent unintentional changes to an environment's value for this constant.

Set constants to environment specific when their values are different based on the environment they are on so that their values can be preconfigured and won't need to be manually updated after an import, e.g. a web service endpoint.

Only constants that are of a primitive type can be set to environment specific.
Save In The folder that the constant is saved into.

Create

Create new constants from the context of an application. Use the New menu within an application to create a new constant. Constants of deprecated types cannot be created except by duplicating a constant of that type.

Reserved Names

The following names are reserved for process report metrics, and must not be used.

  • Completion
  • is_process_ontime
  • is_process_overdue
  • is_task_favorite
  • is_task_ontime
  • is_task_overdue
  • Lag
  • NetCompletion
  • NetLag
  • NetWork
  • process_completion_time
  • process_deadline
  • process_ee_id
  • process_start_time
  • process_status
  • pm_avg_completion
  • pm_avg_lag
  • pm_avg_work
  • task_assignee_owner
  • task_assignment_time
  • task_attributed_to
  • task_avg_completion
  • task_avg_lag
  • task_avg_work
  • task_completion_time
  • task_deadline
  • task_ee_id
  • task_status
  • total_completion_time
  • total_lag_time
  • total_work_time
  • Work

Call a Constant From An Expression

Constants are called using the cons! domain, as shown below.

cons!DATE_FORMAT

Edit

Opening a constant displays its properties in a dialog for editing.

The value of a constant can be changed either from this dialog or from within a process using the Update Constant Smart Service or the Increment Constant Smart Service. When you save a new version of a constant, the latest version is available immediately. This means that any object that uses this constant immediately uses the new version. It is therefore important to carefully consider the impact on running processes when changing constant values. Appian recommends that you follow these best practices to facilitate the change management of constants:

  • Take advantage of entity-backed records and design short-lived processes. See the Record Design page for more information.
  • If the version of your constant must remain in sync with the version of your process, create a new constant and call it from the new version of your process model.

Versions

All versions of an object are saved and designers can view the definitions of old versions; however, when invoked, it is always the latest version that executes.

View Versions

Versions of a single object can be accessed by users with Viewer permissions, by doing one of the following:

  • Select a single object in Appian Designer and select Versions from the toolbar
  • Open the object designer and go to Versions in the Settings menu

This option opens the Versions dialog with a list of versions:

Versions dialog

Revert to a Previous Version

If you wish to revert to an older version, open that version by clicking on it and save it. This will create a new version of the object with the definition that is currently loaded in the designer. Modifying a previous version and saving it as the latest version does not affect the old version. To avoid confusion, you should close the tab from which you opened the Versions dialog, since it now contains an old version.

Delete Versions

Versions can be deleted by users with Editor permissions and if there are multiple versions. A single version can be deleted by clicking the corresponding red X in the rightmost column of the versions grid.

Bulk deletion can be done by selecting filter criteria that returns multiple versions, which causes a message to appear that prompts you to delete the filtered versions. If the latest version is included in the filtered results, it will not be affected by the bulk deletion. This allows for easier and faster cleanup of object versions, in order to maintain useful versions and prevent version buildup that may affect engine memory.

Bulk delete object versions

Move

Users with Administrator permission to this object or rule folder can move it to another folder:

  1. Navigate to the parent folder that the object or folder is in.
  2. Select the object or folder.
    • You can select more than one.
  3. Click the Move button on the toolbar.
    • The Move Objects dialog box is displayed.
  4. Use the folder picker or browser to select the new parent folder.
    • You can also create a new folder in the browser, if you have Editor rights to its parent folder.
  5. Click Move.

NOTE: Any objects that are configured to inherit the security of the parent folder assume the security rights of the target folder.

Delete

Deleting a constant prevents users from further viewing or editing it. However, the last version of the constant is still available to be used in processes, record views, and reports.

Constants can be deleted by users with Administrator or Editor rights to it. To delete a constant, go to an application that contains the rule and use the Delete option in the application contents grid toolbar.

Appian does not recommend deleting constants that are in use because the constant can no longer be exported.

Security

The security rolemap of the constant controls who can see or modify the constant value and properties. However, constants can be evaluated by any user regardless of their defined role in the security rolemap.

The following actions can be completed by each role:

Actions Administrator Editor Viewer Deny
Evaluate the constant Yes Yes Yes Yes
View the constant definition Yes Yes Yes No
Update the constant definition Yes Yes No No
Delete the constant Yes Yes No No
View the security in the application designer Yes Yes No No
Update the security Yes No No No

By default, constants inherit the security of the folder that they are saved in. To view or modify the security of a constant, go to an application that contains the constant and use the Security option in the application contents grid toolbar. For more information on folder security, see the Rule Folder Security page.

You can also restrict users from creating any constants or rules. See the Designer Role section on the User Roles page for more information.

Expression Evaluation Context

When a constant is used in an expression, the value that is returned is the same regardless of which user evaluates the expression. However, functions that use the value may fail based on the user's permission. For example, if the constant value is a group that the user does not have permission to see, the constant returns the value successfully but using the group() function returns an error.

See the User Contexts for Expressions page for more information on what user context is used when evaluating expressions in process.

FEEDBACK