Develop > Tailoring > Web tier > Example: Sending Web tier URLs through e-mail notifications

Example: Sending Web tier URLs through e-mail notifications

The following example creates a notification record with the following properties.

  • Creates an e-mail message whenever someone updates a Service Desk interaction record.
  • The e-mail message contains a direct URL to the updated interaction record.
  • The e-mail message contains a URL to the self-service interface if the record was opened from self-service or a URL to the Web client interface if it was opened from any other interface.

Note: This example assumes you have installed the Service Manager Web tier and an e-mail service.

Update the Web configuration file:

  1. Log on to the Service Manager Web tier server.
  2. Stop the Web tier Web application server.
  3. Open the Service Manager Web tier's Web configuration file (web.xml) in a text editor.

    Note The web.xml file is WEB-INF folder of your Web tier's context root.

  4. Search for the following entry:
    <init-param>
      <param-name>serverHost</param-name>
      <param-value>localhost</param-value>
    </init-param>
    
  5. Change the localhost param-value to the fully-qualified domain name of your Service Manager server, for example, myserver.mydomain.com.
    Replace the values myserver and mydomain.com with the server host name and domain name of the Service Manager server.

    Important You must specify a fully qualified domain name for the serverHost parameter or the server will generate invalid URLs.

  6. Save the Web configuration file.

Update the system information record:

  1. Restart your Web application server.
  2. Log on to the Service Manager server as a system administrator.
  3. Click System Administration > Base System Configuration > Miscellaneous > System Information Record.
  4. Click the Active Integrations tab.
  5. In the WebServer URL field, type the fully qualified URL to your Web tier. For example:
    http://myserver.mydomain.com:myport/SM/index.do
    Replace the values myserver and mydomain.com with the server host name and domain name of the server running the Service Manager Web tier. Replace myport with the communications port your Service Manager Web tier Web server listens for HTTP requests.
    The server stores the value of this field in the $L.web.url global variable.
  6. In the ESS URL field, type the fully qualified URL to your Web tier. For example:
    http://myserver.mydomain.com:myport/SM/ess.do
    Replace the values myserver and mydomain.com with the server host name and domain name of the server running the Service Manager Web tier. Replace myport with the communications port your Service Manager Web tier Web server listens for HTTP requests.
    The server stores the value of this field in the $L.ess.url global variable.
  7. Save the system information record.

Update the SD.incident.mail form:

  1. Log out and restart the Service Manager server.
  2. Log back into Service Manager as a system administrator.
  3. Click Tailoring > Forms Designer.
  4. Search for the form SD.incident.mail.
  5. Click Design.
  6. Add a new text area field with the following properties.

    Property Value
    Input $L.web.url
    Width 400

    This form will display the URL to the Web client interface.

  7. Make any other changes to the form.
    You will use this form as the template for your e-mail messages.
  8. Click OK twice to exit Forms Designer and save the form.
  9. Search for and select the SD.incident.mail form .
  10. Click More or the More Actions icon, and then click Copy/Rename.
  11. In the New Name field, type SD.incident.mail.ess.
  12. Select the Copy option.
  13. Click OK.
  14. Click Design.
  15. Select the text area field you created to display the Web tier URL and update it to have the following properties.

    Property Value
    Input $L.ess.url
    Width 400

    This form will display the URL to the self-service interface.

  16. Click OK twice to exit Forms Designer and save the form.

Update the SM Update notification record:

  1. Click Tailoring > Notifications > Notifications.
  2. Search for the SM Update notification record.
  3. Add the following new rows to the notification record.

    URL sent Msg class Msg No. Arguments Condition Format Notify Method Recipient(s)
    Self-service sm 10 incident.id in $L.file ess.entry in $L.file=true SD.incident.mail.ess email contact.name in $L.file
    Web client sm 10 incident.id in $L.file nullsub(ess.entry in $L.file,false)=false SD.incident.mail email contact.name in $L.file
  4. Click OK to save the notification record.

Create and update a self-service interaction record:

  1. Open a Web browser and log on to the self-service interface.
  2. Create a new self-service interaction record and note the interaction record ID.
  3. From a windows client, click Service Desk > Search Interaction Records.
  4. Use the interaction record ID of the self-service interaction record to retrieve the interaction record details.
  5. Add a category, sub category, and update to the self-service interaction record.
  6. Exit out of the self-service interaction record and return to the Service Desk search form.
  7. Search for SD1001.
  8. Open the Activities section.
  9. In the Update field, type an update.
  10. Click Save.

Review the output event

  1. Click Tailoring > Event Services > Output Events.
  2. Click Search.
  3. Look for an output event with an Event Code of email and the ID number of the self-service interaction record that you created in the External Information String field.
  4. If you are working in a Windows client, right-click in the External Information String field and click Magnify to display the field text in a new window.
  5. Search the form for a URL.
    The URL should contain the path to your self-service interface, for example:
    http://myserver.mydomain.com:myport/SM/ess.do?
    ctx=docEngine&file=incidents&query=incident.id=%22SD10005%22
    &queryHash=eb12d3d8&action=&title=Interaction%20;SD10005
  6. Look for an output event with an Event Code of email and SD1001 in the External Information String field.
  7. If you are working in a Windows client, right-click in the External Information String field and click Magnify to display the field text in a new window..
  8. Search the form for a URL.
    The URL should contain the path to your Web client interface, for example:
    http://myserver.mydomain.com:myport/SM/index.do?
    ctx=docEngine&file=incidents&query=incident.id=%22SD1001%22
    &queryHash=89472347&action=&title=Interaction%20;SD1001

Related concepts

Example: Running custom JavaScript from the Web client
Generating Web tier URL queries

Related tasks

Add URLs for Service Manager clients