Difference between revisions of "Web Page View Field Variables"

From SmartWiki
Jump to: navigation, search
(Displaying a Specific Number of Items in a List)
(To Display a List of Activities, Notes, Transactions, Contacts or Companies)
Line 281: Line 281:
  
 
=To Display a List of Activities, Notes, Transactions, Contacts or Companies=
 
=To Display a List of Activities, Notes, Transactions, Contacts or Companies=
==To display the entire list==
+
==To Display an Entire List==
:<font size="3">[#(?object=''objectname'';)~''fieldname1''~ ~''fieldname2''~#]'''</font>
+
:<font size="3">[#(?object=''objectname'';{options})~''standardfieldname''~ $''customfieldname''$#]'''</font>
 
'''where:'''
 
'''where:'''
* objectname is one of: activity, contact, user, company, notes, association, transaction or level-1
+
:* objectname is one of: activity, contact, user, company, notes, association, transaction or level-1
* fieldname1 and fieldname2 are the names of standard or custom fields on the object
+
:* standardfieldname is the name of a standard field (between tildes ~)
 +
:* customfieldname is the name of a custom field (between dollar signs $)
 +
 
 +
 
 
'''Notes:'''  
 
'''Notes:'''  
:* You can refer to [[Custom Fields]] on the objects using ''customfieldid'' instead of ''fieldname'' and replacing the tilde (~) with a dollar sign ($)
+
:* You can refer to [[Custom Fields]] on the objects using ''customfieldid'' instead of ''customfieldname'', still between dollar signs ($)
 +
:* ''level-1'' can only be used as an object when referenced from a contact record
 +
 
 +
'''Options:'''
 +
:* <font size="3">orderby=''standardfieldname''</font> - sorts the list in ascending order by the standard field specified
 +
:* <font size="3">orderby=''standardfieldname'' desc</font> - sorts the list in descending order by the standard field specified
 +
:* <font size="3">criteria=''standardfieldname''=''value''</font> - filters the list to only those items that meet the criteria specified
 +
:* multiple options can be included, separated by semi-colons (;)
 
   
 
   
:* ''level-1'' can only be used as an object when referenced from a contact record
+
 
 
'''Examples:'''
 
'''Examples:'''
 
* To generate a list of Level 2 activities for a [[MS Word Merge]]:
 
* To generate a list of Level 2 activities for a [[MS Word Merge]]:
  [#(?object=activity;)~status~ ~typename~ ~speciality~ $123456$~#]
+
  [#(?object=activity;)~status~ ~typename~ $speciality$ $123456$~#]
  
*To generate a list of contacts for a [[Web Page View]] (note that the HTML table formatting is included within the '''[#...#]''' syntax)
+
*To generate a list of all contacts for a [[Web Page View]] (note that the HTML table formatting is included within the '''[#...#]''' syntax)
 
<pre>
 
<pre>
<table>[#(?object=contact;)<tr><td>~firstname~</td><td>~lastname~</td><td>~email~</td></tr>#]</table>
+
<table><tr><td>First Name</td><td>Last Name</td><td>E-mail Address</td><td>Cell Phone Number</td></tr>
 +
[#(?object=contact;)<tr><td>~firstname~</td><td>~lastname~</td><td>~email~</td><td>$Cell Phone$</td></tr>#]
 +
</table>
 
</pre>
 
</pre>
  
==To sort the list==
+
==Sorting a List==
 
To sort Ascending:
 
To sort Ascending:
 
:<font size="3">[#(?object=''objectname'';orderby=''fieldname'')~''fieldname1''~ ~''fieldname2''~#]'''</font>
 
:<font size="3">[#(?object=''objectname'';orderby=''fieldname'')~''fieldname1''~ ~''fieldname2''~#]'''</font>

Revision as of 07:19, 27 August 2009

The Web Page View Field provides the ability to display a fully formatted document or web page.

In constructing this type of page HTML is used in conjunction with the following variables.

Variable List

User Variables

Note: "me" -- refers to the current user

@me.firstname@ will be replaced by current user's firstname

@me.lastname@

@me.email@

@me.phone@

@me.companyname@

UTA Level 1, Sales Opportunity and Job Variables

@name@ - standard field Application Name.

@type@ - standard field Application Template Type.

@status@ - standard field Status

@description@

@requirements@

@currency@

@revenue@

@probability@

@modifieddate@

@closedate@

@startdate@

@enddate@

@jobquestions@ - displays as combo boxes

@jobquestionsr@ - displays question only

@jobskills@


@owner.field@

Example: @owner.fullname@ or @owner.address@

@people.field@

Example: @people.fullname@ or @people.address@


@company.field@

Example: @company.name@ or @company.address@


@company.owner.field@

Example @company.owner.email@

@branch.field@

Example: @branch.name@ or @branch.address@


UTA Level 2 / Activities Variables

@subject@

@description@

@location@

@startdate@

@enddate@

@isallday@

@modifieddate@ (numeric value including time)

@longmodifieddate@ (text value excluding time)

@starthour@ - (0-23)

@starth@ - (0-12)

@startpmam@ - (PM or AM)

@startminute@

@endhour@ - (0-23)

@endh@ - (0-12)

@endpmam@ - (PM or AM)

@endminute@

@owner@

@contact@

@assigned@

@eventid@

@objectid@

@objecttype@

@rootcompanyid@


@contact.field@ @eamount@

Example: @contact.firstname@ or @contact.email@

@assigned.field@

Example: @assigned.firstname@ or @assigned.email@

@contact.company.field@ (same as assigned)

Example: @contact.company.address@ or @contact.company.city@

Custom Field Variables

@customfield name@ - by name

or

@#customfield id#@ - by id

Example: @more information@ or @#17342#@


See Also: Invoice Module Variables for Variables specific to the Invoicing module.


UTA Level 1 variables called from UTA Level 2

If your Web Page View is at Level 2, you can call Level 1 variables using:

@parent.fieldname@ or @parent.#fieldid#@ (Note: All field names should be entirely lower case.)

Example: @parent.status@ or @parent.startdate@ or @parent.#12345#@


UTA Level 2 variables called from UTA Level 3

If your Web Page View is at Level 3, you can call Level 2 variables using:

@parent.fieldname@ or @parent.#fieldid#@ (Note: All field names should be entirely lower case.)


UTA Level 1 variables called from UTA Level 3

If your Web Page View is at Level 3, you can call Level ` variables using:

@parent.parent.fieldname@ or @parent.parent.#fieldid#@ (Note: All field names should be entirely lower case.)

Field List

People Fields

firstname, lastname, fullname, title, email, phone, company, address, address2, city, province, state, country, postalcode, owner, modifieddate, cost, costunit, type, resourcename, isrecource, uprefix (prefix), usuffix (suffix), uphoneext (Phone Extension)

Company Fields

name, address, address2, city, province, state, country, postalcode, phone, fax, website

Lead Fields

status, description, name, phone, fax, address, address2, city, state, province, country, postalcode, website, firstname, lastname, contactphone, title, email, dat_added

UTA Contact and Account Variables

  • Owner
@owner.fieldname@
  • Person (Level 1 only)
@people.fieldname@
  • Assigned (Level 2 only)
@people.fieldname@
  • Company (Level 1 only)
@client.fieldname@

Level 1 Contacts/Accounts

Individual

To display information for a single contact/account in the Level 1 contacts/accounts section:

@contact.rolename.fieldname@ or @company.rolename.fieldname@

where:

  • rolename = the name of the role that has been assigned to the contact/account on the Level One item
  • fieldname = the name of the field that is located on the contact's record.

Example:

@contact.adjuster.firstname@ or @company.funding agency.address@

Note: if there is more than one contact/account assigned with the rolename specified only one will be displayed.

List

To display a list of multiple contacts/accounts in the Level 1 contacts/accounts section:

[#(?object=contact;) ~fieldname~ #] or [#(?object=company;) ~fieldname~ #]

See below for details on how to filter and sort the list(s).


Level 2 Contacts/Accounts

Contacts

To display a list of the contacts assigned at Level 2:

[#(?object=contact;) ~firstname~ ~lastname~ ~email~ #]

Note: Contacts at level 2 cannot be filtered by rolename.

Accounts

To display information for a single account in the Level 2 accounts section:

@companies.rolename.fieldname@

Notes:

  • The Account standard field is only available at Level 2 when the Multiple Account list is enabled. See here for details.
  • It is not currently possible to display a list of Accounts for Level 2.

To display Level 1 Company Role or Contact Role custom fields

[#(?object=company;)$?opc_customfieldid$#] or [#(?object=contact;)$?opr_customfieldid$#]

where:

  • customfieldid = the numeric id of the custom field

Following the same format above, you can also reference custom fields on the company role using the @#field id#@ syntax.

Contact Detail

~uprefix~ ~firstname~ ~lastname~

~uaddress~ ~uaddress2~

~ucity~, ~ustate~ ~upostalcode~

Role Based Custom Fields

When you have a Custom Field such as a Web Page View or MS Word Merge that is located on a User Role or Company Role you can access:

  • UTA Level 1 Information:
@levelone.fieldname@ or @levelone.customfieldid@
  • Contact Information:
@contact.fieldname@ or @contact.customfieldid@
  • Company Information:
@company.fieldname@ or @company.customfieldid@


When you want to refer to a User Role based Custom Field from a UTA Level 1 record use the following syntax:

  • Owner:
@owner.fieldname@
  • Person:
@people.fieldname@
  • Contact:
@contact.rolename.fieldname@
where rolename is the role they are assigned on the Level 1 record

To Display a List of Activities, Notes, Transactions, Contacts or Companies

To Display an Entire List

[#(?object=objectname;{options})~standardfieldname~ $customfieldname$#]

where:

  • objectname is one of: activity, contact, user, company, notes, association, transaction or level-1
  • standardfieldname is the name of a standard field (between tildes ~)
  • customfieldname is the name of a custom field (between dollar signs $)


Notes:

  • You can refer to Custom Fields on the objects using customfieldid instead of customfieldname, still between dollar signs ($)
  • level-1 can only be used as an object when referenced from a contact record

Options:

  • orderby=standardfieldname - sorts the list in ascending order by the standard field specified
  • orderby=standardfieldname desc - sorts the list in descending order by the standard field specified
  • criteria=standardfieldname=value - filters the list to only those items that meet the criteria specified
  • multiple options can be included, separated by semi-colons (;)


Examples:

[#(?object=activity;)~status~ ~typename~ $speciality$ $123456$~#]
  • To generate a list of all contacts for a Web Page View (note that the HTML table formatting is included within the [#...#] syntax)
<table><tr><td>First Name</td><td>Last Name</td><td>E-mail Address</td><td>Cell Phone Number</td></tr>
[#(?object=contact;)<tr><td>~firstname~</td><td>~lastname~</td><td>~email~</td><td>$Cell Phone$</td></tr>#]
</table>

Sorting a List

To sort Ascending:

[#(?object=objectname;orderby=fieldname)~fieldname1~ ~fieldname2~#]

To sort Descending:

[#(?object=objectname;orderby=fieldname desc)~fieldname1~ ~fieldname2~#]

Examples:

  • To sort by Start Date in descending order:
 <table>[#(?object=activity;orderby=startdate desc)<tr><td>~subject~</td><td>~location~</td><td>~startdate~</td></tr>#]</table> 
  • to
 <table>[#(?object=activity;orderby=startdate)<tr><td>~subject~</td><td>~location~</td><td>~startdate~</td></tr>#]</table> 



 <table>[#(?object=contact;orderby=lastname;criteria=rolename='Internal People')<tr><td>~firstname~</td><td>~lastname~</td><td>~email~</td></tr>#]</table>

 <table>[#(?object=contact;orderby=lastname;criteria=rolename='Internal People')<tr><td>~firstname~</td><td>~lastname~</td><td>~email~</td><td>~role~</td></tr>#]</table>

  • Note: Search results normally display in ascending order. You may use desc option to display results in descending order.

Example:


With Multiple Criteria:

[#(?object=contact;criteria=(rolename='External' or rolename='Internal'))<tr><td>~firstname~ ~lastname~</td></tr>#]

To sort on custom field:

[#(?object=activity;orderby=tbl_custom field id.valuestr)<tr><td>~location~</td><td>~startdate~</td></tr>#]

e.g. where custom field id=999999

To list a specific activity type only:

[#(?object=activity;orderby=startdate;criteria=typename='')<tr><td>~subject~</td><td>~location~</td><td>~startdate~</td></tr>#]

e.g. where typename='activity name'

[#(?object=activity;orderby=startdate;criteria=typeid='')<tr><td>~subject~</td><td>~location~</td><td>~startdate~</td></tr>#]

e.g. where typeid='141414'

To list activity based on a specific status name or status id:

<table>[#(?object=activity;orderby=startdate;criteria=statusname='')<tr><td>~subject~</td><td>~location~</td><td>~startdate~</td></tr>#]</table>

e.g. where statusname='status name'

<table>[#(?object=activity;orderby=startdate;criteria=status.id='')<tr><td>~subject~</td><td>~location~</td><td>~startdate~</td></tr>#]</table>

e.g. where status.id='1234'

To format the start date and start time

~date_format(startdate,'%Y-%m-%d') as startdate~

or

~date_format(startdate,'%h:%i %p') as starttime~
  • Note: If you wish to use "orderby=startdate", along with a date format other than yyyy-mm-dd you must use a slightly different syntax.
  • Using "~date_format(startdate,'%d-%m-%Y') as startdate~" when using "orderby=startdate" will cause the date to be ordered by dd-mm-yyyy (rather than yyyy-mm-dd, which is chronological)
  • To avoid this, change "date_format(startdate,'%d-%m-%Y') as startdate" to "date_format(startdate,'%d-%m-%Y') as sdate"


To list level two entity at level one using level two fieldname instead of customfield ID

[#(?object=activity;criteria=typeid='19997';)
<tr><td>~index~</td><td>Folder</td><td>$Field Name$</td><td>$customfieldID$</td><td>$customfieldID$</td></tr>
 #]


To list notes (from the record that contains the notes):

[@(?object=notes;orderby=createddate desc)<tr><td>~notes~</td><td>~createddate~</td><td>~username~</td></tr>@]
Note: This syntax is for "Public (Default)" notes only, not custom note types.


To list level 2 notes for each level 2 record at level 1:

[#(?object=activity;orderby=startdate desc)
<tr><td>~subject~</td><td>~description~</td><td>~startdate~</td>
<td><table>
[@(?object=notes;orderby=createddate desc)<tr><td>~notes~</td><td>~createddate~</td><td>~username~</td></tr>@]
</table></td>
</tr>#]
Note: This syntax is for "Public (Default)" notes only, not custom note types.


How to display level three activities at level one in the Web Page View

When displaying a list of Level 2 activities using the [ # (?object=object;orderby=field) # ] processor, the corresponding Level 3 activities can now be displayed under each of the parent Level 2 activities by using [ @ (?object=object;orderby=field) @ ].

This new feature allows level one web page fields to display level 3 items.

This a type syntax for displaying level 2 items.

<table border=1>
[#(?object=activity;orderby=startdate)
<tr><td colspan=2>~subject~</td><td>~location~</td><td>~startdate~</td></tr>
#]
</table> 

This is the syntax showing level 3 items inside level 2 items.

<table border=1>
[#(?object=activity;orderby=startdate)
 
<tr><td colspan=2>~subject~</td><td>~location~</td><td>~startdate~</td></tr>
<tr>
<td>
 
<table bgcolor="00FFFF">
 
[@(?object=activity;orderby=startdate)<tr>
<td>~subject~</td><td>~location~</td><td>~startdate~</td>
</tr>@]
 
</table>
</td>
</tr>
 
#]
</table> 

How to display Level 3 Activities at Level 1 using Read Only-System Variable Field in Web Page View

The Read Only-System Variable field can now be used in the Web Page View field.

This is useful for displaying Level 3 activities at the Level 1 in a Web Page View field.

Currently we can display Level 3 activities at Level 1 using the following syntax:

<table border=1>
[#(?object=activity;orderby=startdate)
 
<tr><td colspan=2>~subject~</td><td>~location~</td><td>~startdate~</td></tr>
<tr>
<td>
 
<table bgcolor="00FFFF">
 
[@(?object=activity;orderby=startdate)<tr>
<td>~subject~</td><td>~location~</td><td>~startdate~</td>
</tr>
@] 

</table>
</td>
</tr>
 
#]
</table> 


This method, however, has the limitation that only Level 3 activities with less than 25 fields can be displayed using this technique.

To display Level 3 activities that have more than 25 fields, the following method is now available:

1. Create a Read Only - System Variable field at Level 2.

2. Format the field as you would a Web Page View field. For example:

<table border=1>
[#(?object=activity;orderby=startdate)
 
<tr><td colspan=2>~subject~</td><td>~location~</td><td>~startdate~</td></tr>
#]
</table>


3. You can now use the field in the Web Page View as you would any other field. For example:

<table border=1>[#(?object=activity;orderby=startdate)<tr><td colspan=2>~subject~</td><td>~location~</td><td>~startdate~</td></tr><tr><td colspan=2>$123456$</td></tr>#]
</table>

Displaying a Specific Number of Items in a List

When you want to display only specific number of activities or transactions in a Web Page View use the following syntax.

 [#(?object=object;orderby=field) 
    <!--@sslogic(~index~='num')--> 
       ~standard field~ $custom field$ <br /> 
    <!--@end--> 
  #] <br /> 

where:

  • num = number of activities that should be displayed

Note:

Date/Time Variables

Standard Fields Date/Time

Variable List:

Start Date End Date Close Date
Level 1 only
Display Format
@startdate@ @enddate@ @closedate@ 2009-01-23
@longstartdate@ @longenddate@ @longclosedate@ Friday, January 23, 2009
@fullstartdate@ @fullenddate@ @fullclosedate@ 2009-01-23 15:40:00
  • Note: Start Time and End Time are stored within the fullstartdate and fullenddate fields respectively. They can be accessed and formatted using the variables elements listed below.


To display specific elements of the Start Date, Start Time, End Date, End Time or Close Date:

@month(fullstartdate)@ month number in Start Date
@monthname(fullstartdate)@ name of month in Start Date
@day(fullstartdate)@ day in Start Date
@dayweek(fullstartdate)@ name of day in Start Date
@year(fullstartdate)@ year in Start Date
@hour(fullstartdate)@ hour in Start Time using 12 hour clock (0-12)
@ampm(fullstartdate)@ AM or PM reference for Start Time
@hour24(fullstartdate)@ hour in Start Time using 24 hour clock (0-24)
@minute(fullstartdate)@ minute in Start Time
Note: For End Date or Close Date replace fullstartdate with either fullenddate or fullclosedate respectively.
(seconds are not available for standard date/time fields)
(Close Date does not have a time associated with it)


Examples:

  • To display the Start Date in the format February 22, 1985 you would use:
@monthname(fullstartdate)@ @day(fullstartdate)@, @year(fullstartdate)@
  • To display the End Time in the format 06:45PM you would use:
@hour(fullenddate)@:@minute(fullenddate)@@ampm(fullenddate)@

Current Date/Time

Variable List:

Variable Content Display Comment
@currentdate@ current date 2009 January 25  
@now@ current date and time 2009 August 25 11:05AM Workflows only. Not available within UTAs


To display specific elements of the current date or time:

@month(currentdate)@ current month number
@monthname(currentdate)@ name of current month
@day(currentdate)@ current day
@dayweek(currentdate)@ name of current day
@year(currentdate)@ current year
@hour(currentdate)@ current hour using 12 hour clock (0-12)
@ampm(currentdate)@ AM or PM reference for current time
@hour24(currentdate)@ current hour using 24 hour clock (0-24)
@minute(currentdate)@ current minute
(seconds are not available for the current time)


Examples:

  • To display the current date/time in the format Friday at 19:55 you would use:
@dayweek(currentdate)@ at @hour24(currentdate)@:@minute(currentdate)@

Custom Fields Date/Time

You can parse out a particular date/time in a date field:

@month(fieldname)@ month number in fieldname
@monthname(fieldname)@ name of month in fieldname
@day(fieldname)@ day in fieldname
@dayweek(fieldname)@ name of day in fieldname
@year(fieldname)@ year in fieldname
@hour(fieldname)@ hour in fieldname using 12 hour clock (0-12)
@ampm(fieldname)@ AM or PM reference for time in fieldname
@hour24(fieldname)@ hour in fieldname using 24 hour clock (0-24)
@minute(fieldname)@ minute in fieldname
@second(fieldname)@ second in fieldname


Examples:

  • To display the custom field Date Of Birth in the format 31-01-2001 you would use:
@day(date of birth)@-@month(date of birth)@-@year(date of birth)@

Miscellaneous Variables

How to display a Dynamic Data grid field

To show a Dynamic Data – Data Grid field in a webpage view field use the following syntax:

@fieldname.table@


Retrieving History for Fields with Track Changes Enabled

The following syntax is used to retrieve custom field history:

For the Status standard field:

@HistoryOf(status)@

For a Custom Field:

@HistoryOf(customfieldid)@
(The field name is not accepted in this case.)

Notes:

  • HistoryOf is case sensitive.
  • You can only obtain the history of the Status field and Custom Fields in this way.

Controls

How to hide a variable if it is missing

Put <!--hideifnotfound--> in front of variable name.

  • Example:
  <!--hideifnotfound-->@parent.contact.adjuster.email@

Note: the variable and the <!--hideifnotfound--> must in immediate succession, and not separated by a space.

How to display different content based on a value using SSlogic

To display content based on a value from a variable add <!--@sslogic('@branch.name@'='Internal Staff')--> in front of the content and <!--@end--> at the end of the content. If there are 2 different pieces of content to be displayed based on a value and all others add <!--@else--> between the 2 pieces of content.

<!--@sslogic(CONDITION)-->
   The content to be displayed when condition is true.
   This can be more than one line.
<!--@end-->
  • The content to be displayed (the middle line) can either be in plaintext or in HTML.
  • Be sure there are single quotes around the variable and value.
  • SSlogic does not support nested logic statements.


Example:

  • The following will display a Christmas tree image if the month is December:
<!--@sslogic(month(now())=12)-->
   <img src='images/xmasstree.jpg'>
<!--@end-->

See SSlogic for more information and further examples.

How to display check boxes in the Web Page View

To display Select Many - Check Box type custom fields as check boxes in a web page view add @checkbox('fieldname/fieldnumber','option name')@ to the check box control.

This syntax works if the check boxes are on the same level. or

Example:

<input type="checkbox" @checkbox('12345','yes')@>
See Also: Updateable Web Page View Fields if you wish the Web Page View check boxes to have the ability to change the underlying data.

How to display level two check boxes on level one in the Web Page View

@checkboxvalue(id||values to be checked)@

<input type="checkbox" name="checkboxb20" value="Limited community support"  @checkboxvalue($1199639$||Limited community support)@>

  • Use two "|" (pipes) to separate id and value to be checked

where 1199639 is customfield id if it is used on the same level @1199639@ if it is used on the child level $1199639$

This works for level one check boxes on level one web page view AND works for level two check boxes on level one web page view AND works for level three check boxes on level one web page view



How to suppress the Page Footer with Printing the Page

To suppress the footer when printing the page you need to change your browser settings.

Internet Explorer

1. Choose the File Page Setup menu.

2. Delete the Header and Footer text.

3. If required, change the margins.

FireFox

1. Choose the File Page Setup menu.

2. Click the Margins & Header/Footer tab.

3. Set all Header and Footer options to Blank.

3. If required, change the margins.

How to control print behavior

To define a page break place the following code in the HTML source before the content you deem as the next page:

<div style="PAGE-BREAK-AFTER: always"><br style="height:0; line-height:0"></div>

To change the page orientation to landscape first place the following in the header portion (<head></head>) of the HTML:

<style type="text/css" media="print">
div.page  { 
writing-mode: tb-rl;
height: 80%;
margin: 10% 0%;
margin-right: 80pt;
filter: progid:DXImageTransform.Microsoft.BasicImage(Rotation=1);
}
</style>
Then place
<div class="page"></div> 
in the HTML source around the "page" content.
Example:
<div class="page">This is the page content that needs to be in landscape</div>

Please note that the page orientation control only works with Internet Explorer and is not the greatest quality print due to the page being converted to an image then rotated.

How to control print behavior when saving as a PDF

To define a page break in a PDF add <pd4ml:page.break/> before the content you deem as the next page.

To change the orientation of a page to landscape in a PDF add <pd4ml:page.break pageFormat="rotate"> before the content you deem as the next page.


Troubleshooting

  • In the event of 2 variables running together (removing the ending @ and beginning @) the issue can be resolved by placing a non-breaking space tag ( ) in between each other.
  • For your list of level 2 activities, your code is showing instead of the field headings and values you've designated.
Try inserting a comment tag before the first cell tag. i.e.
<tr><!--~index~--><td>

See Also