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 on the below links to access their detailed help:
A. Renaming File with Custom Attribute Values
Users can configure a workflow to rename the file including custom attributes while downloading a file. Workflow configuration provides flexibility of renaming the file to be 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 preference can be configured for giving a choice to end user for the renaming option. This configuration controls the user’s selection of renaming preference while downloading. This configuration is optional and is not required if file is to be renamed mandatorily.
Below is the overview of configuration:
Follow the below mentioned steps to configure the workflow:
1. Configure System Task
Select your desired project and 'Configure System Task' with following details:
Name - Enter system task name.
Task Context - Select context type as 'Document' from the dropdown.
Task - Select task 'Execute Groovy Script' from the dropdown.
2. Add Groovy Script
Add following groovy script to the newly configured system task:
|
Above mentioned groovy script has two parts:
Configuration renaming preference: First part of groovy script allows administrators to control whether the remaining configuration will be mandatory or optional with default value checked / unchecked.
|
User can set default value for this option
|
If the preference is set to be editable, use 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 following details:
Add Details - Add all the trigger details like 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 ‘On-Load’. (On-load mode allows user to edit the preference available on user interface).
Task - Select the name of system task created in the step above.
This will invoke the configured system task when user tries to download the file from selected folder.
C. Configuration of Naming Pattern
You can configure the workflow to define the naming pattern for downloaded file. This configuration is required to rename the file.
Below is the overview of how to configure workflow to define naming pattern.
1. Create Custom Attribute
In order to configure the naming pattern of downloaded file. All the required attributes should be available on the project as custom attributes.
Click here to understand how to define custom attributes in a project.
Click here to understand how to define custom attributes in a project template.
2. Configure System Task
Select your desired project and configure a system task with following details:
Name - Enter 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:
|
Above mentioned groovy script is divided into logical parts as mentioned below:
Script | Description |
| This part of groovy script is system defined function to retrieve file metadata.
This part of script is not be edited, and is to be used as is. |
| This part of groovy script is used to define custom attribute that are going to be used in naming pattern.
In order to define the custom attribute that is being used. Create an alias name and use the function to retrieve the values of 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 part of groovy script is used to define naming pattern of the file.
In order to define the naming pattern use the function to set the file name sample format is as mentioned below:
document.setFileName(filename + “<<separator>>” + <<AliasName>> + “<<separator>>” + <<Alias name>> …+ fileExt);
You can add as many custom attribute required in naming pattern as required by adding more alias and adding them to naming pattern. |
| This part of groovy script is to be used when you are expecting multiple values from your custom attribute i.e. custom attribute with type as ‘Multi Select Dropdown’.
This function returns such multiple value as comma(,) separated string.
This function is not required if there are no attributes used that return such multiple value.
This part of script is not be edited, and is to be used as is. |
| This part of groovy script returns the logical values back to the system. And is used to display the response.
This part of script is not 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 following details:
Add Details - Add all the trigger details like 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 directly download the document without confirming).
Task Type - Select the type as ‘Rename File’ (To download the document with the updated name).
Task - Select the name of system task created in the step above.
This will invoke the configured system task when user tries to download the file from selected folder.
D. Example
Folder Name - 'Interior' where set of 2 custom attributes are applied.
Attribute 1 (Dropdown) - Model Code
Attribute 2 (Checkbox) - Usability
For above folder following groovy script is created.
|
In above folder, 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 user either download the file by clicking on 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