An automatic value can be set for a property. This means that, for example, invoices can be consecutively numbered. An automatic value can also contain text, in which case it is a combination of other properties. For example, to create proposal headings in a set format such as Class/Product/Customer, these properties (Proposal/Mach20A/ESTT Corporation) can be used to automatically create the headings.
Automatic values offer increased utilization of document and object metadata in storing and searching for information. In addition, using automatic values makes the naming of documents and objects more consistent and reduces the need for repeated data entries.
Automatic values are especially useful for naming objects (for more information, refer to New Class) and in automatically including metadata in document content (for more information, refer to Insert M-Files Property).
A property can have an automatic number or value. An automatic number is calculated once and it does not change. Such automatic numbering is useful, for instance, in various company internal processes and record-keeping.
An automatic value can contain other properties, usually by concatenating two or more properties. For example, a document name (automatic value) can be defined as Class (Customer), which would return, for instance, Proposal (ESTT). The automatic value changes when the object is edited. If the automatic value is created using the class and customer name (Proposal (Customer A)), the automatic value changes when another customer is selected (Proposal (Customer B)).
Property definition with automatic numbering.
The example above illustrates a property with consecutive numbering in single whole number increments (increment: 1). The last value used is set as 1000. Thus, the next object to use this property will be numbered as 1001. The calculation order value is 100 (see Calculation order below).
Generates an incrementing numerical value. The increment can also be specified (Increment). The default value is one (1).
Generates an automatic number that can contain letters and/or numbers. Creating a customized automatic number is specified in more detail by using the M-Files API and generic features of VBScript. For more information, refer to Editing VBScript Code.
The following M-Files variables can be used with this script: PropertyDef, Output, LastUsed, ObjVer, DisplayID, Vault, CurrentUserID, CurrentUserSessionInfo, PropertyValues, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID. For more information about the variables, refer to VBScript Variables Explained.
Conjoins selected properties (for instance Proposal/Device/Customer). Any characters or text can be inserted between the selected properties. For example: Proposal: Customer (Project) or Proposal, Customer, Project.
A list of available placeholders can be opened when specifying an automatic value for a property. The Add Placeholder… button opens the list of property definitions and other placeholders available for use.
Placeholder | Description |
---|---|
CAUSEDBY | The name of the user who caused the event. |
CAUSEDBYACCOUNT | The account name for the user who caused the event. |
FILENAME | The name of the file. |
HYPERLINKFRAGMENTHTML | An HTML formatted hyperlink containing URLs to the object for M-Files Desktop, M-Files Web, and M-Files Mobile. |
HYPERLINKFRAGMENTPLAIN | A plain-text formatted text fragment containing URLs to the object for M-Files Desktop, M-Files Web, and M-Files Mobile. |
INTERNALID | The (internal) ID of the object. The internal ID is always unique for each object of a single object type and within a single vault (see also OBJID). |
MFILESURL | An M-Files URL that shows the latest version of the object in question. |
MFILESURLTOVERSION | An M-Files URL that shows the specific version of the object in question. |
NOTIFICATIONRULENAME | The name of the notification rule that caused the event. Available for notification templates. |
OBJID | The (external) ID of the object (see also INTERNALID). |
OBJTITLE | The name or title of the object. |
OBJTYPE | Object type. |
OBJVER | Object version. |
ROLLEDBACKTOVERSION | The version that the object was rolled back to. |
TIMESTAMP | The time when the event occurred. |
USERCAUSEDWORKFLOWSTATE_Z | The user who moved the object into a specific state, Z being the ID of the workflow state. |
VAULTNAME | The name of the document vault. |
VAULTGUID | The unique identifier (GUID) of the vault. |
WEBURL | An M-Files Web URL that shows the latest version of the object in question. |
WEBURLTOVERSION | An M-Files Web URL that shows the specific version of the object in question. |
PROPERTY_<ID> | The value of the specified property of the object. (Replace <ID> in the placeholder with the ID of the property definition.) |
OLDPROPERTY_<ID> | The old value of the specified property of the object. (Replace <ID> in the placeholder with the ID of the property definition.) |
OBJTYPE_<ID> | Values of all the properties that can refer to the specified object type. (Replace <ID> in the placeholder with the ID of the object type.) |
Placeholders are used by bracketing them with % characters. For instance, %PROPERTY_23% (%PROPERTY_21%) could give us "John Smith (08/25/2014)", assuming that 23 is the ID for the User name property and 21 the ID for the Modification date.
Indirect placeholders
Indirect placeholders are metadata indirectly related to an object. For example, if a contract is related to a customer object, the country of the customer is indirect metadata for the document.
To specify the customer's country as an indirect placeholder the syntax %PROPERTY_1079.PROPERTY_1090% is used, where 1079 is the property definition ID for Customer and 1090 is the property definition ID for Country.
Creating an automatic value can be specified in more detail by using the M-Files API and generic features of VBScript. A calculated value is defined for the property. For more information about defining calculated values, refer to Editing VBScript Code.
The following M-Files variables can be used with this script: PropertyDef, Output, ObjVer, DisplayID, Vault, CurrentUserID, CurrentUserSessionInfo, PropertyValues, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID. For more information about the variables, refer to VBScript Variables Explained.
The starting value for consecutive numbering or values. The default is zero (0). The value can be changed; for example, consecutive numbering can start at 3000.
Calculation order determines the order in which automatic values are calculated (from smallest to greatest). This is significant when several automatic values are used and their combinations form new automatic values.
For example, calculation order is crucial if the name of an object is an automatic property value consisting of two other automatic values. These two automatic values should be calculated first and their combined value afterward.
The values themselves make no difference other than that the calculation order proceeds from smallest to greatest. The calculation order values for different properties can be, for example, 10, 12, 17 and 20. The property with the calculation order number 10 is thus calculated first, followed by the property with the calculation order number 12, etc.
The Recalculate function is available in M-Files Admin's task area (or by right-clicking) when a property with an automatic value is selected.
Recalculate Empty Values
Calculates automatic values for properties that have not been calculated yet. This is the default for calculating automatic values. Changes to settings only apply to new values. For example, if you edit the Last value used, only new objects will have the new value. Old values are preserved; that is, once defined, a value does not change.
Recalculate All Values
Recalculates the automatic values of all properties. Recalculate All Values thus also recalculates previously defined values. For example, if consecutive numbering is used and the Last value used is changed, this function renumbers all existing objects.
Document templates work differently when automatic values are used. All properties in the template metadata work without the calculation of an automatic value. Thus, in templates, automatic property values work as if they were not automatic. Their values can be defined normally and the server does not calculate an automatic value for the property.
For example, objects in the Proposal class may use automatic values in their titles (such as Proposal <number> - <customer name>). However, it makes sense to name the Proposal class templates as templates; titles using automatic properties only make sense for actual proposals, not templates. Thus, the template might be called Proposal Template, while the actual proposal documents created using the template will have names formulated with automatic values, such as Proposal 35 - ESTT.
For more information, refer to Use Template and New Class.