Page tree

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 quick 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 quick 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. Your variable name can be anything, but make sure to 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 home.htm, home-1table.htm, and home-1column.htm

Update the home pages so that the quick links appear for the appropriate tables.  Agiloft dynamically chooses the home page, so it's best practice to update each home page. If you want to add the quick link to the Quick Links area of the EUI, rather than place it next to a table, see Add a Quick Link to the Quick Links Area.

  1. In the EUI Templates table, open home.htm.
  2. Find the code for the links in the table to which you want to add a quick link. For example, if you want to add a quick link to the Contracts table, look for the following code:

    #if($ewPermission.table("contract","create"))
       <img src="#ew_image('/gif/customicons/20-action-add-nopadding.png')" alt=""/>
       <a href='#ew_forward("new_contract.html")'>$ewText.get('home.con.link')</a>
       </br>
    #end
  3. Copy this code and paste it immediately below the existing code.

  4. Replace the line beginning with <a href . . . with the following code:

    <a href='#ew_forward("new_record.html")?variable=Field Value'>$ewText.get('home.quicklinks.description')</a>
  5. Replace new_record.html with the name of the new record page you edited earlier.
  6. Replace variable with the variable name you defined, and replace Field Value with the value you want for the corresponding field.
  7. Replace home.quicklinks.description with the key you defined in translation.properties. After you enter the values, your code will look something like this:

    <a href='#ew_forward("new_contract.html")?contype=Non-Disclosure Agreement'>$ewText.get('home.quicklinks.disclosure')</a>
  8. If you previously 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:

    <a href='#ew_forward("new_contract.html")?contype=Non-Disclosure Agreement&renewaltype=Evergreen&fordepartment=HR'>$ewText.get('home.quicklinks.disclosure')</a>
  9. If desired, replace /gif/light_orange_red_16/master_light_orange_red_16_96.png in the code block with a new icon for the quick link. You can use one of the existing icons from the other links, or you can edit a Look and Feel scheme, go to the Icons tab, and click Select / Manage to see other icons in the system.

  10. Look over your code to make sure everything is correct. Your completed code will look something like this:

    #if($ewPermission.table("contract","create"))
        <img src="#ew_image('/gif/customicons/20-action-add-nopadding.png')" alt=""/>
        <a href='#ew_forward("new_contract.html")?contype=Non-DisclosureAgreement&renewaltype=Evergreen&fordepartment=HR'>$ewText.get('home.quicklinks.disclosure')</a>
        </br>
    #end
  11. Copy your completed code and click Save.
  12. Paste your completed code in the appropriate areas of both home-1table.htm and home-1column.htm. Make sure to paste the code immediately after the relevant #end directive in the given area for the table. The area to paste the code will look very similar to the area you pasted the code in home.htm.
  13. Go to the home page of the EUI to view your new quick link. Clicking the link opens a new record, and the fields you configured are populated with their defined values.

Add a Quick Link to the Quick Links Area

The quicklinks.htm template file contains existing quick links in the Quick Links area of the EUI. Placing quick links here is optional, but it can be helpful for quick links that perform common actions, such as opening certain service requests. However, for this article, we'll continue with our same example of a quick link that creates a non-disclosure agreement.

  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. Paste only the line of code from your quick link that defines the actual link, enclosing it with <li></li> tags:

    <li><a href='#ew_forward("new_contract.html")?contype=Non-Disclosure Agreement&renewaltype=Evergreen&fordepartment=HR'>$ewText.get('home.quicklinks.disclosure')</a></li>
  4. Click Save. 
  5. Edit home.htm, and scroll to the bottom to find this block of code:

    </div>
      <div class="sidebar">
          #ew_include("$ewText.get('global.search.file')")
          #if($ewPermission.table("helpdesk_case","create"))
             <div class="quicklinks-block">
             #ew_include("quicklinks.htm")
             </div>
          #end
    </div>
  6. Edit the code based on which users you want to view the Quick Links area:
    • If you want all users to view the Quick Links area, remove the lines beginning with #if and #end.
    • If you want only users with certain permissions to view the Quick Links area, edit the #if line to reflect the permission. For example, if you want only users with permission to create contracts to view the Quick Links area, the code will look like this:

      </div>
        <div class="sidebar">
            #ew_include("$ewText.get('global.search.file')")
            #if($ewPermission.table("contract","create"))
               <div class="quicklinks-block">
               #ew_include("quicklinks.htm")
               </div>
            #end
      </div>

      For more information about working with permissions and conditionals, see Permissions and Visibility in the EUI and Macros, Methods, and Conditionals.

  7. Click Save.
  8. Edit the same block of code in both home-1column.htm and home-1table.htm.
  9. View your new quick link in the Quick Links area of the EUI.