This topic lists the custom macros you can use in  EUI Templates. See Macros, Methods, and Conditionals for more information on using macros.

Macros

Macros are based on the Velocity template language. Each of these can be used to insert forms and data into the end user portal. Read more about creating a custom portal in the EUI Portal Tutorial or check out the online training.

The $subtypeName parameter is used in several EUI macros. It refers to the logical table name, which can be found in the Table wizard. For example, the logical table name for the Contracts table is contract. For subtables, the syntax is table.subtype, for example person.employee or ticket.enhancement.

ew_chat

#ew_chat($sessionHash)

This macro lets end users start a chat session. It forms a URL with the chat session ID encoded.

To find the sessionHash:

  1. Go to Setup > Chat and edit the chat configuration. 
  2. On the General tab, select "Web page outside the program," then click Next to proceed to the Access tab. 
  3. When the HTML tab appears, click it.
  4. In the HTML text box, locate "sessionHash=" and select the sequence after it.
  5. Copy the hash, return to the EUI template code, and paste it into the macro.

Usage example:

<a href='#ew_chat("46326e7a79564f5a3271376f4257786b5945344e46413d3d")' target=blank>Do chat!</a>

ew_create_record

#ew_create_record($subtypeName $returnURL $returnFrame)

Use this macro to insert a new record form into an EUI template. It creates a URL that links to the standard record create page for a given table.  See Creating a New Page Tutorial for an example of how this can be used.

Parameter NameDescription

$subtypeName

Logical name of the table in which the new record should be created. The logical name is shown in the tables wizard. Can contain subtable chains like case.question, contact.employee etc.

$returnURL

URL to return to after the ticket is created or cancel is pressed.

$returnFrame

Name of the iframe that contains the view of the table that needs to be refreshed once the operation is completed.

ew_dashboard

#ew_dashboard($dashboardName $showMenu)

Use this macro to insert a dashboard URL into an EUI template. Place the URL in a frame or other HTML content container to show a dashboard in the EUI. Dashboards are shown according to user permissions for power users, and users who are not part of a power user group can only see Hotlink, Table, URL, Image and Text widgets.

Parameter NameDescription

$dashboardName

The name of the dashboard as it appears in the dashboard list. If the $dashboardName value is empty, the most recently selected dashboard is shown; if no dashboard has been selected, the default dashboard is shown.

$showMenu

Use $showMenu to specify whether to show the dashboards drop-down list at the top. If the $showMenu value is empty, the default setting is True, which shows the list.

ew_edit_record

#ew_edit_record($subtypeName $recordId $returnURL $returnFrame)

This macro inserts a record edit form into an EUI template. It creates a URL that links to the standard record editing page for a given table and record ID.

Parameter NameDescription

$subtypeName

Logical name of the table in which the new record should be created. The logical name is shown in the tables wizard. Can contain subtable chains like case.question, contact.employee etc.

$recordId

The ID of the record to edit

$returnURL

URL to return to after the ticket is created or cancel is pressed

$returnFrame

Name of the iframe that contains the view of the table that needs to be refreshed once the operation is completed.

ew_faq

#ew_faq($subtypeName)

ew_forward

$ew_forward($templateName)

This URL simply creates links between EUI template pages without losing the user's session ID. Use this whenever you create links between pages; it creates a URL to forward the user to the specified  template.

Parameter NameDescription

$templateName

Template name. If the template doesn't exist, using this URL will result in an error to allow the designer to debug and fix errors

Example usage:

<a href="#ew_forward("testContacts.htm")">Contacts</a>

ew_image

#ew_image($imageName)

Forms the URL to the image with the given name. As an admin user, you can upload images to your KB via the power user interface in the Look & Feel section. The $imageName parameter should be a relative path to the image from the file directory. For example:

<img src="#ew_image('/gif/icon21.png')" alt="Next" />

Image names with spaces or special characters should be properly URL encoded. For example, linking to an image called icon 21.png requires the following format, replacing the space with %20:

<img src="#ew_image('/gif/icon%2021.png')" alt="Next" />

ew_include

#ew_include($templateName)

This macro is a shortcut to include the contents of one EUI Template in another.

Parameter NameDescription

$templateName

Includes $templateName into the current one. This allows admins to reuse common pieces of code in different templates.

ew_languages

#ew_languages($controlName $onChange $controlStyle)

Renders a list of available languages for the current user with a particular HTML style. The style needs to be passed here as a parameter, because  will render the HTML control automatically, making it impossible to customize its appearance any other way.

Parameter NameDescription

$controlName

Required name of the HTML select list.

$onChange

JavaScript code to be run when a language is selected.

$controlStyle

CSS class name for the select list control.

ew_languages_all

#ew_languages_all($controlName $onChange $controlStyle)

Renders a list of all languages available in the system with a particular HTML style. You need to pass the style here as a parameter, because  will render the HTML control automatically, making it impossible to customize its appearance any other way.

Parameter NameDescription

$controlName

Required name of the HTML select list.

$onChange

JavaScript code to be run when a language is selected.

$controlStyle

CSS class name for the select list control.

ew_locale

#ew_locale($localeName)

Sets the language (locale) for the current user session to the specified one if the language is available for the user.

Parameter NameDescription

$localeName

Java 7 locale code ("en", "de", "fr")

https://www.oracle.com/java/technologies/javase7locales.html

ew_logins

#ew_login($kbName $redirectTo)

Prints the  login URL. This tag must be enclosed in <form> with input controls "login", "password" inside. If no user and login is passed, then system will attempt to login under the predefined user eui2/qwerty. Create this user in your KB to use this default.

Parameter NameDescription

$kbName

name of KB to login

$redirectTo

name of template to be used after successful login

ew_logout

#ew_logout($url)

Logs out of  and redirects the user to the specified URL.

Parameter NameDescription

$url

URL to be redirected after logout, such as a confirmation message or intranet home page.

<a href="#ew_logout("http://www.example.com")">Click to logout</a>

ew_new_search

#ew_new_search($subtypeName $frameName $allowSaving $returnURL $params)

Provides a piece of JavaScript, mostly for use in onClick event handlers, that runs the new Saved Search wizard. When returning to $returnURL, an additional request parameter is appended for the created saved search - searchID. You can use it in your own code, for example to update a list of available Saved Searches.

Parameter NameDescription

$subtypeName

Table for which the search should be created

$frameName

The name of HTML iframe in which to display the results after the Wizard has finished, e.g. "opener.my_table".

$allowSaving

"true" if the user should be allowed to save the created search, otherwise "false".

$returnURL

URL that should be applied to $frameName after wizard has finished. If "", than the standard table search will be used.

$params

Visualization Parameters formed as a request query, e.g. "showstatus=false&showpages=false..." etc. They will be applied to the table view for $subtypeName. Use this parameter if you leave $returnURL empty. Otherwise add required Parameters to $returnURL directly.

ew_query

#ew_query($subtypeName $frameName $controlId $params $viewName)

Provides a piece of JavaScript, mostly for use in onClick or onChange event handlers, that runs a search for a table in an iframe. 

Parameter NameDescription

$subtypeName

The name of the table to show

$frameName

The name of HTML iframe in which to display the results.

$controlId

The id of the HTML control which contains the query to use (for example a form field)

$params

String of request Parameters that will be passed to the table in $frameName. See the #ew_table macro, and the following parameter list for details.

$viewNameLabel of the View to be applied to the search results.  Note that when ew_query is used inside of ew_table, any view associated with a search specified by the ew_table macro takes precedence, as does the viewName specified in that macro if the search itself doesn't have an associated view.

ew_recordfield 

#ew_recordfield ($fieldName $subtypeName $recordID)

Forms the URL to show the field value from the record and table specified.

Parameter NameDescription

$fieldName

Field name in the selected table, for example "description" or "attached_files".

$subtypeName

Logical table name containing the record, e.g. "document" or "person.employee".

$recordID

The ID of the record you want to access, e.g. 224.

#ew_recordfield("description_text" "document" 224)

ew_repchart 

#ew_repchart ($repchartName $repchartType $tableName)

Forms the URL to show the Report or Chart with the given name from the specified table.

Parameter NameDescription

$repchartName

Name of report or chart as listed in the Table Charts/Reports list.

$repchartType

Type of the report or chart. Allowed values are [html, image, excel, plain/text].

$tableName

Name of the table containing the report or chart.

ew_scripts

#ew_scripts()

Introduces a link to certain required JavaScript functions. The default  EUI requires some custom JavaScript code. Use it within a page's <head> tag if you are getting strange behavior and / or JavaScript errors about null and undefined objects in your portal templates.

ew_searches_list

#ew_searches_list($subtypeNames $frameName $controlName $controlStyle $params $selectedSearch $viewName)

Draws an HTML select list control with the Saved Searches available, taking into account access permissions.

Parameter NameDescription

$subtypeNames

Name of the table or tables for which to display the appropriate searches. To show searches from multiple tables, enter a comma-delimited list of tables. If you enter multiple tables here, the $selectedSearch and $viewName parameters are ignored.

$frameName

Name of the iframe that contains the view of the table that needs to be refreshed once a search is selected.

$controlName

Required name of the HTML select list.

$controlStyle

CSS class name to be applied to the select list.

$params

String of the request Parameters that will be passed to the table in $frameName. See the #ew_table macro, and the following parameter list for details.

$selectedSearch

Name of the search to be selected in list initially

$viewNameLabel of the View to be applied to the search results

ew_session

#ew_session()

Prints session ID to screen, and requires no parameters. This may be used to 'manually' construct a URL that contains the session information.

 <a href="/gui2/eui2template/testContacts.htm;#ew_session()">Contacts</a>

results in:

<a href="/gui2/eui2template/testContacts.htm;jsessionid=D7988DF0E8E173...

ew_status

#ew_status()

Prints to screen last operation status stored in the request, ActionStatus. This macro requires no parameters.

ew_table

#ew_table($subtypeName $viewName $searchName $queryString $params $frameName $frameStyle $showLabel)

Draws an HTML iframe with the specified  table displayed inside it.

Parameter NameDescription

$subtypeName

The table to show.

$viewName

The view to use for table. Note that it's localized for now, so different names should be used for different languages.  Also note that any view associated with the applied search takes precedence over this parameter.  Both of these take precedence over the view specified in any ew_query macro used inside of this macro.

$searchName

The search name to apply to the table. Can be used simultaneously with $queryString

$queryString

The query to be applied to the table. When used, the result is the same as if the user had typed the contents of this string into the search box. See the #ew_query macro below.

$params

Visualization Parameters formed as a request query, e.g. "showstatus=false&showpages=false..." etc. Use it for precise tuning of the table's display features. See the parameter list at the end of this section for more details.

$frameName

The required name of the resulting iframe. This is needed so that you can refer to it in other macros or pieces of JavaScript (for example to refresh the table view after a search has been applied - see the tutorial).

$frameStyle

The CSS style name to be applied to the iframe.

ew_user

ew_user()

Prints the current user login to screen. This macro does not take parameters.

ew_userfield

#ew_userfield($fieldName)

Prints the current user's record field value. This macro is rendered to be human-readable; for example, choice values will be returned as 'Yes'. In practice, enter the logical name of the field in quotation marks.

Parameter NameDescription

$fieldName

A logical name of the field to return. Example: #ew_userfield("_16_company_name0")

ew_userid

#ew_userid()

Prints the current user ID to screen; requires no parameters.

ew_url

#ew_url($url)

Parameter NameDescription

$url

Prints to screen $url with the application url prefix and session data encoded. If you want to make an asset for your portal page available for portal users but not to anyone else, for example an image logo, then you can upload it to the server, and use this macro to construct a URL, including session information, to retrieve it.

Example usage

<img border = "0" src = "#ew_url("images/logo.jpg")"/>

ew_view_record

#ew_view_record($subtypeName $recordId $returnURL $returnFrame)

Creates a URL which links to the record view .

Parameter NameDescription

$subtypeName

Logical name of the table in which the record should be viewed.

$recordId

The ID of the record to view.

$returnURL

URL to return to after the ticket is created or cancel is pressed

$returnFrame

Name of the iframe that contains the view of the table that needs to be refreshed once the operation is completed.

Visualization Parameters ($params)

Visualization parameters apply to the following macros:

Parameter NameValues (default in bold)Description

showSearchCriteria

true, false

Whether used search criteria will be shown to user

workWithPopUp

true, false

Determines whether edit and new operations should be performed within the current frame or the pop-up window

showToolBar

true, false

Show action bar on top of table

showLabeltrue, falseShow label for the table

showNavigation

true, false

Show pages navigation above the table

showStatus

true, false

Show status of operations on above the table

showfastsearch

true, false

Show search dialog for the table

search_contexttrue, false

Turn on Context for text searches

Usage: turn on Context for text searches from the EUI2 by using:

#ew_query("contract" "my_table" "queryId" "showToolBar=false&showNavigation=true&showfastsearch=false&search_context=true")

_saved_search_idany saved search id

Filter text searches by a saved search

Usage:

#ew_query("contract" "my_table" "queryId" "showToolBar=false&showNavigation=true&showfastsearch=false&_saved_search_id=12345")

Related articles