Class Message

Represents a Service ticket message.

Examples

Message m;

m.load(2); // Loads message with id = 2
m.setValue("emailHeader", "Test");
m.setValue("body", "This is a test");
m.save();

Constructors

Message()

Initializes a new instance of the Message class.

Declaration

Message

Examples

Message m;

m.load(2); // Loads message with id = 2
m.setValue("emailHeader", "Test");
m.setValue("body", "This is a test");
m.save();

Methods

addHeader(String,String)

Adds a header to the message. The headers will be shown at the view request page, listed at the message.

Declaration

Void addHeader(String type, String value)

Parameters

Type Name Description
String type Type of header as a String, examples are To, Cc, SMS, Bcc
String value The header to add as a String, common values are recipients of the message as a comma-separated String.

Returns

Type Description
Void

convertInlineImages()

Convert any inline images in the message from (cid: to normal http).

Declaration

Void convertInlineImages()

Returns

Type Description
Void

getAttachments()

Returns an array of all the attachment IDs on the message.

Declaration

Integer[] getAttachments()

Returns

Type Description
Integer[] Array of attachment IDs.

getValue(String)

Returns the value a column.

Declaration

String getValue(String colName)

Parameters

Type Name Description
String colName Column name of the value.

Returns

Type Description
String A string value of the column.

load(Integer)

Loads the message with the given ID.

Declaration

load(Integer id)

Parameters

Type Name Description
Integer id ID of message.

Returns

Type Description
Bool True if successful; otherwise, false.

save()

Saves a message and returns the database ID.

Declaration

Integer save()

Returns

Type Description
Integer The database Id.

save(String)

Saves a message and returns the database ID.

Declaration

Integer save(String log)

Parameters

Type Name Description
String log Log entry to add to the ticket log that this message belongs to.

Returns

Type Description
Integer The database Id.

save(String.Bool)

Saves a message and returns the database ID.

Declaration

Integer save(String log, Bool noNewInfo)

Parameters

Type Name Description
String log Log entry to add to the ticket log that this message belongs to.
Bool noNewInfo Used in combination with log. Set it to false if your changes should turn the readStatus on ticket yellow (if the readStatus is green).

Returns

Type Description
Integer The database Id.

saveInvolved(String)

Saves the email address of a single recipient of a message.

Declaration

Void saveInvolved(String emailAddress)

Parameters

Type Name Description
String emailAddress A single email address for 1 recipient.

Returns

Type Description
Void

saveInvolved(Vector)

Saves the email address of a single recipient of a message

Declaration

Void saveInvolved(Vector emailAddresses)

Parameters

Type Name Description
Vector emailAddresses A collection of email addresses for multiple recipients.

Returns

Type Description
Void

send(Vector,Vector,Vector)

Sends an email version of the message to the main contacts on the parent ticket.

Declaration

Bool send(Vector to, Vector cc, Vector bcc)

Parameters

Type Name Description
Vector to The to-recipients in the email
Vector cc The cc-recipients in the email
Vector bcc The bcc-recipients in the email.

Returns

Type Description
Bool True if everything is OK; otherwise, false.

send(Vector,Vector,Vector,Integer)

Sends an email version of the message to the main contacts on the parent ticket. Merges with reply template in the settings of the submitted category ID.

Declaration

Bool send(Vector to, Vector cc, Vector bcc, Integer categoryId)

Parameters

Type Name Description
Vector to The to-recipients in the email
Vector cc The cc-recipients in the email
Vector bcc The bcc-recipients in the email
Integer categoryId The ID of the category to check for reply template merge. Alternative to subject.

Returns

Type Description
Bool True if everything is OK; otherwise, false.

send(Vector,Vector,Vector,String)

Sends an email version of the message to the main contacts on the parent ticket using the given subject

Declaration

Bool send(Vector to, Vector cc, Vector bcc, String subject)

Parameters

Type Name Description
Vector to The to-recipients in the email
Vector cc The cc-recipients in the email
Vector bcc The bcc-recipients in the email
String subject The subject in the email. Alternative to categoryId.

Returns

Type Description
Bool True if everything is OK; otherwise, false.

send(Vector,Vector,Vector,String,String)

Sends an email version of the message to the main contacts on the parent ticket using the given subject, and a given heading for the body part.

Declaration

Bool send(Vector to, Vector cc, Vector bcc, String subject, String bodyHeading)

Parameters

Type Name Description
Vector to The to-recipients in the email
Vector cc The cc-recipients in the email
Vector bcc The bcc-recipients in the email
String subject The subject in the email. Alternative to categoryId.
String bodyHeading The body heading. Used with subject.

Returns

Type Description
Bool True if everything is OK; otherwise, false.

sendFacebook()

Posts message to Facebook

Declaration

Void sendFacebook()

Returns

Type Description
Void

sendSms(Vector)

Sends an sms-version of the message to the numbers in the vector.

Declaration

Bool sendSms(Vector to)

Parameters

Type Name Description
Vector to The numbers to send the message to.

Returns

Type Description
Bool True if successful; otherwise, false.

setAttachments(Vector)

Connects the attachments to the message.

Declaration

Void setAttachments(Vector ids)

Parameters

Type Name Description
Vector ids The IDs of the attachments.

Returns

Type Description
Void

setValue(String,String)

Sets the value of column colName to the given value

Declaration

Void setValue(String colName, String value)

Parameters

Type Name Description
String colName Column name of the value
String value Value that should be stored in the column.

Returns

Type Description
Void

toParser(Parser)

This function loads many fields of the message to the input parser.

Declaration

Void toParser(Parser parser)

Parameters

Type Name Description
Parser parser The parser that the message values is loaded into.

Returns

Type Description
Void