Difference between revisions of "Template Variables for Actions and Components"

From LongJump Support Wiki
imported>Aeric
 
imported>Aeric
 
(14 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[File:Templatevariablesinactions.gif|right|thumb]] Use this lookup tool to build Template Variables for:
__TOC__
*[[#Template Variables for Actions in Components|Actions in Components]]
==== About the Template Variable Tool====
*[[#Template Variables for Actions Using Execute JavaScript|Actions Using Execute JavaScript]]
Use the Template Variable tool (shown below) to insert variables for:
:*[[#Template Variables for Actions in Components|Actions in Components]]


:''Compare to [[Template Variables]]
:*[[#Template Variables for Actions Using Execute JavaScript|Actions Using Execute JavaScript]]


[[AJAX and REST]] can be used to communicate with the platform, by writing JavaScript in an Action. The following implicit variables are available in the JavaScript:
::[[File:Templatevariablesinactions.gif|left|frame|Template Variable Selector]]<br style="clear:both"/>


;<tt>object_id</tt>: Variable containing the identifier of the selected record
{{Note|In some contexts, variable names uses braces - <tt>{ }</tt>. In other cases, they don't. The Template Variable Tool lets you quickly determine the format used in your current context.
;<tt>selectedRecords</tt>: Array containing the identifiers of the selected records:
:''Learn more:'' [[Template Variables]]}}
:* For Single Action: Array containing one element with the identifier of the selected record
 
:* For Group Action: Array containing multiple elements with the identifiers of the selected records
====About Template Variables====
[[AJAX and REST]] can be used to communicate with the platform, by writing [[JavaScript]] in an Action. The following implicit variables are available in the JavaScript:
 
:;<tt>object_id</tt>: A variable containing the identifier of the object
:;<tt>selectedRecords</tt>: An array containing one element - the identifier of the selected record


;Examples:
;Examples:
Line 19: Line 24:
::<tt>alert("You have selected Record : " + selectedRecords[0];</tt>
::<tt>alert("You have selected Record : " + selectedRecords[0];</tt>


===Lookup a Template Variable===
====Lookup a Template Variable====
#Choose a Category
#Choose a Category.
#;Category:Can contain any of the following:
#;Category:Each category contains a number of fields. The list of categories depends on your context.
#::*[[Objects]]
#Choose a field from the Category.
#::*<tt>$ObjectID</tt>
#;Fields:Contains the available fields from the selected category.<br>The Variable Field is populated with the syntax for your choice
#::*<tt>$GROUP_ACTION</tt>
#Copy the string and paste it into your work
#::*<tt>$CUSTOM_CONTROL</tt>
#::*Fields related to Users
#Choose a field from the Category
#;Fields:Contains the available fields from the selected category
#In the Variable Field, find the correct syntax for the template variable
#:Copy the string and paste it into your work (as part of an Email / Print / Workflow HTML template, as Email Subject or in the Body of the message, or in an [[Action]]
#;Variable field:<tt>{$account.name}</tt>
#;Variable field:<tt>{$account.name}</tt>


:Note: The Field Name is not same as the Field Label
{{Note|When specifying a field, you use it's internal ''Field Name''. Not the 'Field Label'' that appears in the GUI.}}


====Template Variables for Actions in Components====
=====Template Variables for Component Actions=====
{{:Template Variables for Actions in Components}}
{{:Template Variables for Component Actions}}


====Template Variables for Actions Using Execute JavaScript====
=====Template Variables for Actions Using Execute JavaScript=====
{{:Template Variables for Actions Using Execute JavaScript}}
{{:Template Variables for Actions Using Execute JavaScript}}
<noinclude>


__FORCETOC__
[[Category:JavaScript]]
</noinclude>

Latest revision as of 02:29, 11 October 2011

About the Template Variable Tool

Use the Template Variable tool (shown below) to insert variables for:

Template Variable Selector

Notepad.png

Note: In some contexts, variable names uses braces - { }. In other cases, they don't. The Template Variable Tool lets you quickly determine the format used in your current context.

Learn more: Template Variables

About Template Variables

AJAX and REST can be used to communicate with the platform, by writing JavaScript in an Action. The following implicit variables are available in the JavaScript:

object_id
A variable containing the identifier of the object
selectedRecords
An array containing one element - the identifier of the selected record
Examples
Identifier of the object that the user selected:
alert("You have selected object : " + object_id);
Dialog that shows the identifier of the first selected record:
alert("You have selected Record : " + selectedRecords[0];

Lookup a Template Variable

  1. Choose a Category.
    Category
    Each category contains a number of fields. The list of categories depends on your context.
  2. Choose a field from the Category.
    Fields
    Contains the available fields from the selected category.
    The Variable Field is populated with the syntax for your choice
  3. Copy the string and paste it into your work
    Variable field
    {$account.name}

Notepad.png

Note: When specifying a field, you use it's internal Field Name. Not the 'Field Label that appears in the GUI.

Template Variables for Component Actions

The following template variables are available for use in Actions in Components. Some template variables are not evaluated when the action is executed. In the following table:

  • "Yes" indicates that the template variable is evaluated when the action is executed
  • "--" indicates that the template variable is not evaluated when the action is executed
A warning message is displayed when a template variable is included that is of the not evaluated type.
Category Template Variable Single Record Group Action Both

Single Record

Both

Group Action

Object {$fieldname} Yes -- Yes --
$ObjectID {$object_id} Yes Yes Yes Yes
$GROUP_ACTION {$GROUP_ACTION.ids} Yes Yes Yes Yes
$CUSTOM_CONTROL {$CUSTOM_CONTROL.[ComponentName]} Yes Yes Yes Yes
User
{$user.today} Yes Yes Yes Yes
{$user.full_name} Yes Yes Yes Yes
{$user.first_name} Yes Yes Yes Yes
{$user.last_name} Yes Yes Yes Yes
{$user.email} Yes Yes Yes Yes
{$user.phone} Yes Yes Yes Yes
{$user.city} Yes Yes Yes Yes
{$user.state} Yes Yes Yes Yes
{$user.zip} Yes Yes Yes Yes
{$user.country} Yes Yes Yes Yes
{$user.title} Yes Yes Yes Yes
{$user.division} Yes Yes Yes Yes
{$user.fax} Yes Yes Yes Yes
{$user.mobile} Yes Yes Yes Yes
Template Variables for Actions Using Execute JavaScript

The following JavaScript template variables are available for use in Actions using the Execute JavaScript option. Some template variables are not evaluated when the action is executed. In the following table:

  • "Yes" indicates that the template variable is evaluated when the action is executed
  • "--" indicates that the template variable is not evaluated when the action is executed.
A warning message is displayed when a template variable is included that is of the not evaluated type.
Category Template Variable Single Record Group Action Both

Single Record

Both

Group Action

Object {$fieldname} Yes -- Yes --
$AppSessionID {$AppSessionID} Yes Yes Yes Yes
User
{$user.today} Yes Yes Yes Yes
{$user.full_name} Yes Yes Yes Yes
{$user.first_name} Yes Yes Yes Yes
{$user.last_name} Yes Yes Yes Yes
{$user.email} Yes Yes Yes Yes
{$user.phone} Yes Yes Yes Yes
{$user.city} Yes Yes Yes Yes
{$user.state} Yes Yes Yes Yes
{$user.zip} Yes Yes Yes Yes
{$user.country} Yes Yes Yes Yes
{$user.title} Yes Yes Yes Yes
{$user.division} Yes Yes Yes Yes
{$user.fax} Yes Yes Yes Yes
{$user.mobile} Yes Yes Yes Yes