Difference between revisions of "Using Variables as Default Values in Single Line and Multi-line Text Box Custom Fields"

From SmartWiki
Jump to: navigation, search
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
If you would like to use a [[Web Page View Field Variables|variable]] as the default value for a single-line or multi-line text box, instead of static text, you should enter '''"@@"''' in the ''Default Text'' box on the [[Custom Field|custom field]], followed by any text and variable(s) you wish to appear:
+
If you would like to use a [[Web Page View Field Variables|variable]] as the default value for a [[Custom Field Type: Text – Single Line|single-line]] or [[Custom Field Type: Text – Multiple Lines|multi-line]] text box, instead of static text, simply include the variable(s) in the '''Default Text''' box on the [[Custom Field|custom field]], along with any other text you wish to appear:
  
  
 
'''Example 1:''' To populate the default text as the current user's e-mail address use the following:
 
'''Example 1:''' To populate the default text as the current user's e-mail address use the following:
 
<pre>
 
<pre>
@@@me.email@
+
@me.email@
 
</pre>
 
</pre>
  
Line 10: Line 10:
 
'''Example 2:''' To populate the default text of a '''Level 1''' [[Custom Field|custom field]] with the words "The client is" followed by the company name associated with the Level 1 entity, use the following:
 
'''Example 2:''' To populate the default text of a '''Level 1''' [[Custom Field|custom field]] with the words "The client is" followed by the company name associated with the Level 1 entity, use the following:
 
<pre>
 
<pre>
@@The client is @company.name@
+
The client is @company.name@
 
</pre>
 
</pre>
  
Line 16: Line 16:
 
'''Example 3:''' To populate the default text of a '''Level 2''' [[Custom Field|custom field]] with the words "The client is" followed by the company name associated with the Level 1 entity, use the following:
 
'''Example 3:''' To populate the default text of a '''Level 2''' [[Custom Field|custom field]] with the words "The client is" followed by the company name associated with the Level 1 entity, use the following:
 
<pre>
 
<pre>
@@The client is @parent.company.name@
+
The client is @parent.company.name@
 
</pre>
 
</pre>
  
  
''Explanation: the "@@" at the beginning of the Default Text box tell the system to look for variables. Any variables will be between their own "@" symbols as per usual, and any text not between "@" symbols will be represented as standard text.''
+
'''Example 4:''' You can use more than one variable:
 +
<pre>
 +
If you wish to contact @assigned.firstname@ please send an e-mail to @assigned.email@  
 +
</pre>
  
  
'''Note:''' As with any [[Custom Field|custom field]] that has a default value, when editing the form if you clear the value so that the field is empty, it will re-populate with the default value when saved. Accordingly an empty value cannot be saved in any field with a default value (whether it includes a variable or not).
+
'''Note:''' As with any [[Custom Field|custom field]] that has a default value, when editing the form if you clear the value so that the field is empty it will re-populate with the default value when saved. Accordingly an empty value cannot be saved in any field with a default value (whether it includes a variable or not).
  
[[Category:Custom Fields]][[Category:Enhancements]]
+
[[Category:Custom Fields]][[Category:Variables]]

Latest revision as of 17:04, 14 July 2009

If you would like to use a variable as the default value for a single-line or multi-line text box, instead of static text, simply include the variable(s) in the Default Text box on the custom field, along with any other text you wish to appear:


Example 1: To populate the default text as the current user's e-mail address use the following:

@me.email@


Example 2: To populate the default text of a Level 1 custom field with the words "The client is" followed by the company name associated with the Level 1 entity, use the following:

The client is @company.name@


Example 3: To populate the default text of a Level 2 custom field with the words "The client is" followed by the company name associated with the Level 1 entity, use the following:

The client is @parent.company.name@


Example 4: You can use more than one variable:

If you wish to contact @assigned.firstname@ please send an e-mail to @assigned.email@ 


Note: As with any custom field that has a default value, when editing the form if you clear the value so that the field is empty it will re-populate with the default value when saved. Accordingly an empty value cannot be saved in any field with a default value (whether it includes a variable or not).