Page tree
Skip to end of metadata
Go to start of metadata

Using Quick Links to Prepopulate Records in the EUI

This article explains how you can configure quick links in the EUI to create records that prepopulate certain fields. This allows users to create various types of tickets or records so that certain fields already contain desired values. For example, you might configure a Create Critical Ticket link that creates a service request, sets the Priority field to High, and adds "URGENT" to the Summary field. Similarly, you could configure a Create New NDA link that creates a contract and sets the Contract Type field to Non-Disclosure Agreement.

Prerequisites

Before making the changes described in this article, we recommend that you create copies of the original EUI template files. We also recommend that you have a basic understanding of the following topics:

  • HTML

For more information on HTML, visit W3 Schools.

Edit translation.properties

To define a quick link, begin by creating the key and corresponding link text in translation.properties.

  1. In the EUI Templates table, edit translation.properties.
  2. Go to the area with the home.quicklinks keys and add "home.quicklinks.description=Your Link Text" to a new line. For example, you might add "home.quicklinks.disclosure=Create a New Non-Disclosure Agreement" or similar.
  3. If desired, add additional quick links on new lines.
  4. Click Save.

Edit new_record.htm

Next, set the link parameters in the corresponding new_record.htm template file. For example, if your link creates a new contract, use new_contract.htm. If your link creates a new incident, use new_incident.htm.

  1. In the EUI Templates table, edit new_record.htm.
  2. Place your cursor after <div id="main_frame"> and before <iframe src='#ew_create_record..., and then press Enter.
  3. Copy and paste the following code in the template file:

    #set($variable = $request.getParameter("variable"))
    #set($params = "")
    #if($request.getParameter("variable"))
    #set($params="field_name=${variable}")
    #end
  4. Replace variable with a variable name that represents the field you want to populate. Use lowercase letters without any spaces.
  5. Replace field_name with the name of the field you want to populate. Make sure to use the field name, not the field label. After you enter the values, your code will look something like this:

    #set($contype = $request.getParameter("contype"))
    #set($params = "")
    #if($request.getParameter("contype"))
    #set($params="contract_type=${contype}")
    #end
  6. If desired, add additional #set, #if, and #end directives to populate more fields in the new record. Additional #set directives include an extra ${params}& string before the field name. For example, if you want to also populate the Renewal Type field in a contract, your code will look like this:

    #set($contype = $request.getParameter("contype"))
    #set($renewaltype = $request.getParameter("renewaltype"))
    #set($params = "")
    #if($request.getParameter("contype"))
    #set($params="contract_type=${contype}")
    #end
    #if($request.getParameter("renewaltype"))
    #set($params="${params}&renewal_type=${renewaltype}")
    #end
  7. In the <iframe src... line, add &${params}' as shown in this code block:

    <iframe src='#ew_create_record("contract" "/eui2template/main.php" "parent")&${params}' name="content_frame" id="frameres" width="100%" frameborder="0"></iframe>
  8. Click Save.

Edit quicklinks.htm

The quicklinks.htm template file contains existing quick links in the EUI. For this article, we place the quick links in this file so that they appear in the default Quick Links area of the EUI. However, you can also create quick links in other areas of the EUI.

  1. In the EUI Templates table, edit quicklinks.htm.
  2. Place your cursor after the last </li> tag and before the </ul> tag, and then press Enter.

  3. Copy and paste the following code in the template file:

    <li><a href='#ew_forward("new_record.html")?variable=Field Value'>$ewText.get('home.quicklinks.description')</a></li>
  4. Replace new_record.html with the name of the new record page you edited earlier.
  5. Replace variable with the variable name you defined, and replace Field Value with the value you want for the corresponding field.

    If the field value contains single or double quotes, the quotes must be preceded by a backslash (\). For example, if you populate the Summary field in a service request, your code might look like this: 'ew_forward("new_servicerequest.html")?summary=I\'m reporting an urgent issue!'>.

  6. Replace home.quicklinks.description with the key you defined in translation.properties. After you enter the values, your code will look something like this:

    <li><a href='#ew_forward("new_contract.html")?contype=Non-Disclosure Agreement'>$ewText.get('home.quicklinks.disclosure')</a></li>
  7. If you defined additional fields to populate, use an ampersand (&) after the field value, and enter the appropriate variable and value pair for each additional field. For example, if you want to also populate the Renewal Type and For Department fields in a contract, your code will look like this:

    <li><a href='#ew_forward("new_contract.html")?contype=Non-Disclosure Agreement&renewaltype=Evergreen&fordepartment=HR'>$ewText.get('home.quicklinks.disclosure')</a></li>
  8. Click Save. Your new quick link appears in the Quick Links area on the EUI. Clicking the link opens a new record, and the fields you configured are populated with their defined values.