With AODocs, you can set up conditional logic in document classes in any type of AODocs library. When users edit their documents, conditional logic is applied as follows:
- property values can be calculated automatically
- properties can be conditionally mandatory or hidden
- document titles can be calculated automatically (in Document Management libraries only)
Conditional logic is calculated using formulas that can include references to other entities such as custom or system properties, custom property states (mandatory or hidden) and the document title.
Before you use this article, you should:
- be familiar with the basics – learn more: What is conditional logic in AODocs?
- know how to set up conditional logic in the library configuration to:
This article explains the syntax of the entity references you can add to your formulas when you configure conditional logic. Use this article alongside the article Getting started with formulas for conditional logic to build simple formulas with copied code snippets. You can also use this article for reference when building your own formulas from scratch.
Advanced users can get creative and write their own formulas for conditional logic:
- Create your own formulas: play with entity references in JavaScript
- Create your own formulas: use the correct JavaScript syntax for conditional logic
Learn about entity references:
Automatically generated table of contents
References to entities issued from the document
Custom properties
Custom property values
References to custom property values (including Category property values) in your formula have this syntax:
propertyType`Name of your property`
For example:
- String property value:
propertyString`Project Name`
- Category property value:
propertyCategory`Country`
Notes:
– The name of the property you use in your formula is case sensitive.
– If a custom property has one or more backquotes ( ` ) in its name, it can still be referenced from a formula by escaping the backquotes with backslashes ( \ ). For example: PropertyType`List \`1\``
.
You can add this syntax manually to your formula or select properties in the formula builder. Learn more: What can I use in my formula?
Example of a coded use case: Calculate a duration between two dates.
Custom property states (mandatory or hidden)
In the formula to make your property conditionally mandatory or hidden, you can reference whether another custom property is mandatory or hidden using this syntax:
propertySettings`other custom property`.mandatory
propertySettings`other custom property`.hidden
A few rules apply:
-
This syntax is only available in formulas to make properties conditionally mandatory or hidden and not in formulas to calculate property values or titles.
-
In the formula to make your property conditionally mandatory or hidden, you can't reference as mandatory any properties with calculated values because these properties are never filled in by users. In this case, the Mandatory (true or false) option isn't available in the menu.
-
In the formula to make your property conditionally mandatory or hidden, you can't reference whether the current property is hidden, whereas you can reference whether it is mandatory.
You can add this syntax manually to your formula or select properties in the formula builder. Learn more: What can I use in my formula?
System properties
References to system properties in your formula have this syntax.
|
systemPropertyString`title` |
|
systemPropertyString`id` |
|
systemPropertyString`stateId` |
|
systemPropertyDateTime`creationDate` |
|
systemPropertyDateTime`stateChangeDate` |
You can add this syntax manually to your formula or select properties in the formula builder.
Example of a coded use case: Create a document sequence ID with a fixed prefix.
Current document version properties
References to current document version properties in your formula have this syntax.
|
systemPropertyString`currentVersionName` |
|
systemPropertyDateTime`currentVersionCreationDate` |
|
systemPropertyString`currentVersionDescription` |
You can add this syntax manually to your formula or select current document version properties in the formula builder.
Sequence IDs
Learn more: What is the sequence ID?
References to sequence IDs in your formula have this syntax.
|
sequenceId`library` |
|
sequenceId`class` |
|
sequenceId`document` |
You can add this syntax manually to your formula or select sequence IDs in the formula builder.
Example of a coded use case: Create a sequence ID for all documents in a document class.
References to entities issued from the library
Category values defined at the library level
References to category values defined at the library level include the category name, the value name and the ID of the value:
categoryValue`Document type:Procedure(SDxe5OG000001ptLxh)`
Where:
Document type
is the Category name(SDxe5OG000001ptLxh)
is the category value ID- where
Procedure
is the category value
References to category values use the ID in addition to the value name because any given category value is not necessarily unique in a category; it’s only unique at a given level within a given category.
Within the same library, a given category value can be used in:
- several categories – for example, "France" may be a value of the "Country" and "Market" categories
- in several levels in multi-level categories – for example, "London" may exist as both the "Region" and "Town" levels in the category hierarchy "Country/Region/Town"
Difference between category values in properties and category values defined at the library level
Category values in documents refer to the specific values of Category type properties in your document. These category values can change, depending on the value selected by users in your document. Learn more: Edit categories.
In contrast, category values defined at the library level are constants. Categories are defined at the library level and contain a set list of values. Learn more: Create categories.
When do you use category values in documents?
Use these category values when you need to add to your formula the value of a Category type property defined in a document. When the formula runs, the current value defined in your document is used. For example: Create a document sequence ID with a prefix issued from a Category property.
When do you use category values defined at the library level?
Use these category values when you need to add to your formula a reference to a "constant" category value defined in the category configuration of your library. In this case, you reference a specific value in your formula, it doesn’t depend on the values defined in documents.
Workflow states
References to workflow states in your formula have this syntax:
state`Workflow state name`
For example: state`Published`
Note: The name of the workflow state you use in your formula is case sensitive.
You can add this syntax manually to your formula or select workflow states in the formula builder. Learn more:
- Configure conditional logic to calculate property values
- Configure properties to be conditionally mandatory or hidden
- Configure conditional logic to calculate document titles
Example of a coded use case: Use workflow states in calculated property values.