Free cookie consent management tool by TermsFeed Constants [Appian Expressions]
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.

This page explains how to create, edit, and delete constants, and how you can reference them in an expression.

Properties

Each constant has the following properties:

Property Description
Name The name that is used when executing the constant. This property is case-insensitive, but we recommend that you follow the recommended naming standard. Certain constant names are reserved for system use.
Description Supplemental information about the constant that is displayed in the expression editor and in the objects grid of some Designer views.
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, for example, a web service endpoint.

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

Reserved names

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

  • 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

Create

Constants of deprecated types cannot be created except by duplicating a constant of that type.

To create a constant:

  1. In your application, go to the Build view.
  2. Click NEW > Constant.
  3. Configure the constant properties.

    constantCreator

  4. Click CREATE.

Edit

There are two ways to edit a constant: from the Build view, or using the Update Constant Smart Service or the Increment Constant Smart Service.

To edit a constant from the Build view:

  1. In your application, go to the Build view.
  2. Select the constant name to open it. This displays the Constant Properties dialog.
  3. Edit the constant properties as needed.

    constantEditor

  4. Click SAVE.

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

For information on how to manage object versions, see Managing 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 appears.
  4. Use the folder picker or browser to select the new parent folder.

    Tip:  You can also create a new folder in the browser, if you have Editor permissions 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.

Duplicate

Developers must have Viewer permissions to a constant to duplicate it.

To duplicate a constant:

  1. In your application, go to the Build view.
  2. Select the checkbox next to the constant you want to duplicate.
  3. Click DUPLICATE.

    constantEditor

  4. Update the duplicated constant properties as needed.
  5. Click CREATE.

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 permissions to it. Appian does not recommend deleting constants that are in use because the constant can no longer be exported.

To delete a constant:

  1. In your application, go to the Build view.
  2. Select the checkbox next to the constant you want to delete.
  3. Click DELETE.
  4. In the Delete Constant? dialog, ensure there are no objects that depend on the constant.

    Note:  If there are objects that depend on the constant, then deleting the constant will cause an error to appear in those objects.

  5. Click DELETE.

Tip:  System administrators have the ability to delete constants (and other objects) in bulk by selecting them and clicking Delete in the toolbar.

Call a constant from an expression

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

1
cons!CSA_DATE_FORMAT

Note:  Any user can access the value of any constant that is referenced by an interface or process they have permissions to.

A user must have at least Editor permissions to increment or update a constant's value via a smart service in a process model.

The security role map of a constant controls which developers can see or modify it and its properties.

By default, constants inherit the security of the folder that they are saved in. However, after creating the constant, you can disable that inheritance and modify the constant's security. See Editing Object Security to modify a constant's security.

The following table outlines the actions that can be completed for each permission level in a constant's security role map:

Actions Administrator Editor Viewer Deny
Evaluate the constant Yes Yes Yes Yes
View the constant definition Yes Yes Yes No
Duplicate the constant Yes Yes Yes No
Update the constant definition* Yes Yes No No
View the security Yes Yes No No
Rename the constant Yes Yes No No
Delete the constant Yes No No No
Update the security Yes No No No

*Constant values can be edited via either the increment constant smart service or update constant smart service in process models. Users must have Editor permissions to the constant to execute these smart services successfully.

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.

Constants

FEEDBACK