Asite Visual Workflow allows users to download files by renaming them using applicable custom attribute values. Administrators can also use the Groovy scripts to configure the download files interface to show or hide the custom attribute file renaming option. Click the below links to access their detailed help:
A. Renaming File with Custom Attribute Values
Users can configure a workflow to rename the files including custom attributes, while downloading. The workflow configuration allows for flexibility in making the renaming process mandatory or optional.
Configuration can be done in 2 stages:
1. Configuration the download preference for user selection (Optional).
2. Configuration of naming pattern.
Below is an overview of the configuration:
B. Configuration of Download Preference
Download preferences can be configured to provide users with the option to rename files option. This configuration controls the user’s selection of renaming preferences while downloading. This configuration is optional and is not required if the file is to be renamed mandatorily.
Below is the overview of the configuration:
Follow the below-mentioned steps to configure the workflow:
1. Configure System Task
Select your desired project and 'Configure System Task' with the following details:
Name - Enter the system task name.
Task Context - Select the context type as 'Document' from the dropdown.
Task - Select task 'Execute Groovy Script' from the dropdown.
2. Add Groovy Script
Add the following Groovy script to the newly configured system task:
|
The above-mentioned groovy script has two sections:
Configuration renaming preference: The first section of the Groovy script allows administrators to control whether the remaining configuration will be mandatory or optional with the default value checked / unchecked.
|
Users can set the default value for this option.
|
If the preference is set to be editable, users can choose to rename the file while downloading it with the following options:
Rename Files with Custom Attributes
Rename Files with Doc Ref
Append Doc Title
Append Version Number
Append Revision Number
Note: Selecting the 'Rename Files with Custom Attributes' preference will disable all other renaming preferences.
3. Create Trigger
Once the system task is configured, create a new workflow trigger on the selected project with the following details:
Add Details - Add all the trigger details including name, description, priority and conditions with the context as ‘Document’.
Event - Select the trigger event as 'Download Documents'.
Task Mode - Select the task mode as ‘On-Load’. (On-load mode allows the user to edit the preference on the user interface).
Task - Select the name of the system task created in the step above.
This will invoke the configured system task when the user tries to download the file from the selected folder.
C. Configuration of Naming Pattern
You can configure the workflow to define the naming pattern for the downloaded file. This configuration is required to rename the file.
Below is the overview of how to configure workflow to define naming patterns.
1. Create Custom Attribute
To configure the naming pattern of the downloaded file. All the required attributes should be available on the project as custom attributes.
Click here to learn how to define custom attributes in a project.
Click here to learn how to define custom attributes in a project template.
2. Configure System Task
Select your desired project and configure a system task with the following details:
Name - Enter the system task name.
Task Context - Select the task context as 'Document'.
Task - Select task 'Execute Groovy Script'.
3. Add Groovy Script
Add the following Groovy script to the newly configured system task:
|
The above-mentioned groovy script is divided into logical sections as mentioned below:
Script | Description |
| This section of the Groovy script is a system-defined function to retrieve file metadata.
This section of the script is not to be edited and is to be used as is. |
| This section of the Groovy script defines custom attributes for use in naming patterns.
To define the custom attribute that is being used. Create an alias name and use the function to retrieve the values of the custom attribute in that defined alias, sample format is as mentioned below:
String <<Alias name>> = getValue(documentService.getCustomAttributeValue(document,”<<Custom Attribute Name>>”));
In the sample code given beside Alias Name and respective custom attributes are as mentioned below:
Alias Name = docTypeCode, docCodeSeq, supportedDocTypes Custom Attribute Name = Document_Type_Code, Document_Code_Seq, Supported_Doc_Types |
| This section of the Groovy script defines the file's naming pattern.
To define the naming pattern use the function to set the file name sample format as mentioned below:
document.setFileName(filename + “<<separator>>” + <<AliasName>> + “<<separator>>” + <<Alias name>> …+ fileExt);
You can add as many custom attributes as required in the naming pattern by adding more aliases and adding them to the naming pattern. |
| This section of the Groovy script is designed for use when you expect multiple values from your custom attribute i.e. custom attribute with ‘Multi Select Dropdown’ type.
This function returns multiple values as a comma(,) separated string.
This function is not required if no attributes that return such multiple values are used.
This section of the script is not to be edited and is to be used as is. |
| This section of the Groovy script returns the logical values to the system and is used to display the response.
This section of the script is not to be edited and is to be used as is. |
4. Create Trigger
Once the system task is configured, create a new ‘Trigger’ on the selected project with the following details:
Add Details - Add all the trigger details including name, description, priority and conditions with the context as ‘Document’.
Event - Select the trigger event as ‘Download Documents’.
Task Mode - Select task mode as ‘Pre’. (To download the document without confirming).
Task Type - Select the type ‘Rename File’ (To download the document with the updated name).
Task - Select the name of the system task created in the step above.
This will invoke the configured system task when the user tries to download the file from the selected folder.
D. Example
Folder Name - 'Interior' where 2 custom attributes are applied.
Attribute 1 (Dropdown) - Model Code
Attribute 2 (Checkbox) - Usability
For the above folder, the following groovy script is created.
|
In the above folder, the user uploads a file named - ‘Curtains’ with below standard and custom attributes:
Version (Auto display): 1
Model Code: 001
Usability: Drawing Room, Bed Room
Output: When the user either downloads the file by clicking the icon or by downloading the file by setting download preference, where ‘Rename file name as custom attribute’, file downloaded with the name as, Curtains_001_Drawing Room, Bed Room_1_jpg
Check: FAQs
Next Article: Automatic Revision Numbering