Difference between revisions of "Web Page View Field Variables"

From SmartWiki
Jump to: navigation, search
(How to display different content based on a value using SmartLogic)
Line 389: Line 389:
 
Example: <!--hideifnotfound-->@parent.contact.adjuster.email@
 
Example: <!--hideifnotfound-->@parent.contact.adjuster.email@
 
</pre>
 
</pre>
 +
  
 
==How to display different content based on a value using SSlogic==
 
==How to display different content based on a value using SSlogic==
Line 414: Line 415:
  
 
'''[[SSlogic|See here]] for more information and further examples.'''
 
'''[[SSlogic|See here]] for more information and further examples.'''
 +
 +
 +
==How to Attach a PDF File to Web Page View Field==
 +
 +
This directive is not visible to web page in HTML mode but is effective when exported as a PDF, saved as a PDF, emailed PDF and created by [[Workflow|workflow]] as attachment.
 +
 +
'''Sample Codes'''
 +
* Append a PDF file from a [[Smart Folder]] '''before''' the current [[Web Page View Field]] page.
 +
 +
<pre>
 +
<!- - @ssattach(before;/files/1234/123/myfile.pdf )- ->
 +
</pre>
 +
 +
* Append a PDF file from a [[Smart Folder]] '''after''' the current [[Web Page View Field]] page.
 +
<pre>
 +
<!- - @ssattach(after;/files/1234/123/myfile.pdf )- ->
 +
</pre>
 +
 +
3.  Appending current web page field to a PDF file from a [[Custom Field|custom field]] (single file type).
 +
 +
<pre>
 +
<!- - @ssattach(before;@attach pdf file@)- ->
 +
</pre>
 +
::::or
 +
<pre>
 +
<!- - @ssattach(before;@#xxxxxxx#@)- -> where xxxx is customfield id.
 +
</pre>
 +
 +
'''Rules'''
 +
 +
* Directives can be placed anywhere inside the field, more than one directive can be used like this.
 +
 +
<pre>
 +
 +
-----------------------------------------------------------------------------------------------
 +
<!- - @ssattach(before;/files/1234/123/myfileheader.pdf )- ->
 +
<!- - @ssattach(after;/files/1234/123/myfilefooter.pdf )- ->
 +
<!- - @ssattach(after;/files/1234/123/myfileappendix.pdf )- ->
 +
 +
 +
    <html><body>
 +
  My Pdf file
 +
</body></html>
 +
 +
</pre>
 +
 +
* All page settings will driven by first PDF document file, either it is a static file or generated by [[SmartSimple]]
 +
 +
 +
'''SSlogic'''
 +
 +
* Using @customfield@ instead of [[Smart Folder|smart folder]] file (like @parent.contract@)
 +
* Use if sslogic like this:
 +
 +
<pre>
 +
<!- -@sslogic(‘@type@’=’contact’) - ->
 +
      <!- -@ssattach(after;/files/1234/123/myfilefooter.pdf )- ->
 +
 +
<!--@else-->
 +
    <!- - @ssattach(after;/files/1234/123/myotherfilefooter.pdf )- ->
 +
<!--@end-->
 +
 +
</pre>
 +
  
 
==How to display check boxes in the Web Page View==
 
==How to display check boxes in the Web Page View==

Revision as of 13:21, 2 June 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, prefix, 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

How to display contact information for people associated in the Contacts section

Use the variable:

@contact.rolename.field@

where

rolename = the name of the role that has been assigned to the contact on the Level One item

field = the name of the field that is located on the contact's record.


Example: @contact.adjuster.firstname@ or @contact.project manager.address@

How to display contact information for Companies (Accounts) associated in the Contacts section

Use the variable:

@company.rolename.field@

where

rolename = the name of the role that has been assigned to the Company on the Level One item

field = the name of the field that is located on the Company's record.


Example: @company.insurance companies.name@ or @company.consulting firms.address@

How to display a list of UTA Level 1 Activities, Contacts or Companies

object= [activity,contact,user,company,association,level-1 (applies to contacts only) or transaction]

<table>[#(?object=object;orderby=field)<tr><td>~field~</td><td>~field~</td><td>~field~</td><td>$customfield id$</td></tr>#]</table>

Example:

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

 <table>[#(?object=contact;orderby=lastname)<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></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:

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

Results will be sorted on Startdate in Descending order.

To sort on custom field:

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

e.g. where custom field id=999999

To list a specific activity type only:

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

e.g. where typename='activity name'

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

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>
 #]

How to display a UTA contact role or company role record

[#(?object=company;orderby=name)<td>~name~</td><td>~customfields~</td>#]

How to display Level 1 Company Role or Contact Role custom fields

[#(?object=company;orderby=name)<td>$?opc_fieldid$</td>#]

OR

[#(?object=contact;orderby=fullname)<td>$?opr_fieldid$</td>#]

fieldid = 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~

How to Display a Date or Time Format

The following date variables are available for a long date format:

@longclosedate@

@longstartdate@

@longenddate@

@fullstartdate@

Example: @longstartdate@ returns "Tuesday, November 15, 2005"

The following date variables are also available:

@now@ - full current date and time

@currentdate@ - full current date only

To display only specific elements of the current date:

@month(currentdate)@ - month number

@day(currentdate)@ - day

@year(currentdate)@ - year

@dayweek(currentdate)@ - name of day

@monthname(currentdate)@ - name of month

To display only specific elements of the full start date:

@month(fullstartdate)@ - month number

@day(fullstartdate)@ - day

@year(fullstartdate)@ - year

@dayweek(fullstartdate)@ - name of day

@monthname(fullstartdate)@ - name of month

You can also parse out a particular date format in a date field:

@year(datefield)@ - returns the year value in datefield

@month(datefield)@ - returns the month value in datefield

@day(datefield)@ - returns the day value in datefield

For Time fields:

@hour(datefield)@ - returns the hour value in datefield (0-12)

@ampm(datefield)@ to provide a reference for am/pm

@hour24(datefield)@ - returns the hour value in datefield (0-24)

@minute(datefield)@ - returns the minute value in datefield

@second(datefield)@ - returns the second value in datefield

How to hide a variable if it is missing

Put <!--hideifnotfound--> in front of variable name like this

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


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 here for more information and further examples.


How to Attach a PDF File to Web Page View Field

This directive is not visible to web page in HTML mode but is effective when exported as a PDF, saved as a PDF, emailed PDF and created by workflow as attachment.

Sample Codes

<!- - @ssattach(before;/files/1234/123/myfile.pdf )- ->
<!- - @ssattach(after;/files/1234/123/myfile.pdf )- ->

3. Appending current web page field to a PDF file from a custom field (single file type).

<!- - @ssattach(before;@attach pdf file@)- -> 
or
<!- - @ssattach(before;@#xxxxxxx#@)- -> where xxxx is customfield id.

Rules

  • Directives can be placed anywhere inside the field, more than one directive can be used like this.

-----------------------------------------------------------------------------------------------
<!- - @ssattach(before;/files/1234/123/myfileheader.pdf )- ->
<!- - @ssattach(after;/files/1234/123/myfilefooter.pdf )- ->
<!- - @ssattach(after;/files/1234/123/myfileappendix.pdf )- ->


    <html><body>
  My Pdf file
 </body></html>

  • All page settings will driven by first PDF document file, either it is a static file or generated by SmartSimple


SSlogic

  • Using @customfield@ instead of smart folder file (like @parent.contract@)
  • Use if sslogic like this:
<!- -@sslogic(‘@type@’=’contact’) - ->
       <!- -@ssattach(after;/files/1234/123/myfilefooter.pdf )- ->

<!--@else-->
     <!- - @ssattach(after;/files/1234/123/myotherfilefooter.pdf )- ->
<!--@end-->


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 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>

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.

How to display a Dynamic Data grid field

To show the data grid field in the webpage view field use the syntax '@fieldname.table@'.

How to display the Transaction types

In order to display a transaction type and its fields use the following example:

Syntax:

[#(?object=transaction;orderby=fieldname;criteria=typename='')<tr><td>$customfieldid$</td><td>$customfieldid$</td></tr>#]

Example Code:

[#(?object=transaction;orderby=tbl_1041842.valuestr desc;criteria=typename='Co-Principal Investigor, Co-Applicant, Additional Author')
<tr><td>$1041842$</td><td>$1041843$</td><td>$1041844$</td><td>$1041845$</td></tr>
#]


To retrieve all Company transactions for the company attached to Level 1 (Standard field - Customer):

@company.[#(?object=transaction)<tr><td>~details~</td><td>~subject~</td><td>~startdate~</td></tr>#]@

To retrieve all Branch transactions for the branch attached to Level 1 (Standard field - Branch):

@branch.[#(?object=transaction)<tr><td>~details~</td><td>~subject~</td><td>~startdate~</td></tr>#]@

To retrieve all People transactions for the user attached to Level 1 (Standard field - Owner):

@owner.[#(?object=transaction)<tr><td>~details~</td><td>~subject~</td><td>~startdate~</td></tr>#]@

To retrieve the Level 1 transactions at Level 2:

@parent.[#(?object=transaction)<tr><td>~details~</td><td>~subject~</td><td>~startdate~</td></tr>#]@

To retrieve the Level 1 transactions at Level 2 by transaction type:

@parent.[#(?object=transaction;criteria=typename='Name of Transaction Type')
<tr><td>$fieldid$</td><td>$fieldid$</td><td>$fieldid$</td><td>$fieldid$</td></tr>
#]@

Impact: Transactions on the Company and User objects can now be displayed in a UTA web page view. The transaction does not have to directly associated with the Level 1 item.


To get the modified date of a transaction use the following:

~trsts~ or ~date_format(trsts,'%Y-%m-%d') as lastmodified~

How to display specific number of activities or transactions

When you want to display only specific number of activities or transactions from underlying level, 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

Role base Web page view field

When you have a role base web page view field or company based webpage view field you can access the levelone, contacts, or company information.

@levelone.custom field name/custom field id@
@levelone.standard field name@
@company.custom field name/custom field id@
@company.standard field name@
@contact.custom fieldname/custom field id@
@contact.standard field name@



Retrieving Custom Field History

The following syntax is used to retrieve custom field history:

For Status : @HistoryOf(status)@

For Customfield : @HistoryOf(####)@  where #### is the Custom Field ID. (The field name is not accepted in this case.)

@HistoryOf()@  ******************************************   Case sensitive ********************************************************

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