Set Field Value action enables the automatic inserting of the specified value into the specific field in the item window. For example, it sets the Estimated Revenue when you move from one status on project to another as sum of Estimated People Costs and Estimated Other Costs multiplied by coefficient. If the Set Field Value action is executed, the field is locked for editing and pre-filled by the value you set in the action definition. The field is unlocked again after saving changes and you can edit the field.
|Database Field||Insert the name of the field you want to fill in with preset value. Insert the database name of the field, but only this that is available in the module related with the workflow. The database field name can be found out if you click into the field in the item window and the press Alt+F1 - the name of the field/column will show.|
|Field Value||Field allows you to set the value you want to show in the field. You can fill in a plain text, but you can also use SQL queries with SQL# prefix. For the better arranged entering, click the ... button right to the text field itself. If you click it, the larger text window will be opened where you can easily add your commands.|
System variables can be used in fields during actions creating. For more information, go to System Variables Available in Actions.
Find an overview of possible values that can be filled for different field types in the table:
|Field Type||Value for Field Value|
|Text or Link||Insert text you want to show in the field.|
For example 5000 or any decimal number. You can insert it like 0.123 or 0,123, but if you want to be sure that number will be read correctly, you can set it as SQL command:
SQL# SELECT 0.123
Null value can be inserted in this way:
SQL# SELECT NULL
You can also work with SQL query and use a mathematical definition for a calculation of the project final price. The example shows that the sum of Estimated People Expenses and Estimated Other Expenses are multiplied by the 1.4 coefficient:
SQL# SELECT (EstimatedPeopleExpenses + EstimatedOtherExpenses)*1.4 FROM Projects WHERE HID = '$CURRENT_ITEM[HID]'
|Percentages||Insert as a decimal number - 0,3 or 0.3 for 30 %.|
1 or 0, you can set also TRUE or FALSE.
You can use SQL command that could look like this:
SQL# SELECT CAST(0 AS BIT)
You can fill fixed date, for example in the DD.MM.RRRR format.
You can also use the SQL function getDate that returns today's date and is able to add or subtract days. In our example, the date 20 days from today (the day the action is executed) is inserted:
SQL# SELECT getdate()+20
|Drop Down Menu||
You need to fill in the database identificator of value from drop down menus.
You can insert values as GUID, for example:
You can define the setting of the deal resource, where en is the column with the English name of the drop down menu value and the text between quotation marks is the value we want to find. You can use other language columns for comparison (cs, ru, de, sk, no):
SQL# SELECT ItemID FROM EnumValues WHERE en = 'Current Customer'
|Multi Drop Down Menu||
You can use similar ways as for drop down menu. You can insert more than one value for multi drop down menu, so you can use more GUIDs that are separated by commas, for example:
You can also use SQL commands. This one set that all values in the multi drop down menu will be selected (AF_XX must be replaced with real database name of the field):
SQL# SELECT ItemID FROM EnumValues WHERE EnumType = (SELECT ItemID From EnumTypes WHERE EnumName = 'AF_XXX')
You need to insert the database name of the field (see the first row of the example below). You can add the relation box for the relation to a costumer on a project or a bookkeeping record. You can compare a company as in the first example by the FileAs name or by the company ID as in the second example.
CUSTOMER SQL# SELECT ItemID FROM Companies WHERE FileAs='eWay-CRM'
CUSTOMER SQL# SELECT ItemID FROM Companies WHERE ID='253'
If you want to set field value on custom field of relation type, you does not use prefix with module specification, you just type af_XXX (XXX is number of custom field that is its specification in database; you can find out the database name of the field when you have cursor on it and press ALT+F1; if you are user, you can find it out in Administration Application > section Custom Fields).
If you wish to save the currently defined action for future use in a different workflow, you can do it via Template->Export. If you have already defined actions of the Set Field Value type and you have already exported them from earlier workflow editing, you can reuse them via the menu Template->Import. More information about the import and export of workflow actions can be found in the chapter: Import and Export of Workflow Action Definitions.