RecordToHTML - Global

A utility class to turn a record into HTML.

The RecordToHTML class is available to server-side scripts.

RecordToHTML - RecordToHTML(String table, String sys_id, String pattern, Boolean link)

Creates an instance of RecordToHTML class.

Table 1. Parameters
Name Type Description
table String The record's table name
sys_id String The sys_id of the record
pattern String The pattern of the string to generate. The pattern may include ${} escapes for fields whose values should be included. For example, the pattern "sys_id: ${sys_id}" would substitute the actual sys_id for the escape.
link Boolean

var r2html = new RecordToHTML("incident","e8e875b0c0a80164009dc852b4d677d5", 
        "incident: ${number}-${short_description}", true);
gs.print(r2html.toString());

Output: incident: INC00005-CPU load high for over 10 minutes

RecordToHTML - setValue(String fieldName, String value)

Sets the specified field to the specified value.

Table 2. Parameters
Name Type Description
fieldName String Name of the field to change.
value String Value to set the field to.
Table 3. Returns
Type Description
void

var r2html = new RecordToHTML("incident","e8e875b0c0a80164009dc852b4d677d5", "incident: ${number}-${short_description} (${user})", true);
r2html.setValue("user",gs.getUserName());
gs.print(r2html.toString())

Output: incident: INC00005-CPU load high for over 10 minutes (john.roberts)

RecordToHTML - toString()

Converts the record to a string.

Table 4. Parameters
Name Type Description
None
Table 5. Returns
Type Description
String HTML output of the record.

var r2html = new RecordToHTML("incident","e8e875b0c0a80164009dc852b4d677d5", 
                          "incident: ${number}-${short_description}", true);
gs.print(r2html.toString());

Output: incident: INC00005-CPU load high for over 10 minutes