Skip to main content
Represents a Service ticket message.

Constructors

Message()

Initializes a new instance of the Message class.

Methods

addHeader(String,String)

Adds a header to the message. The headers will be shown at the view request page, listed at the message.
Returns: CRMScript.Global.Void
This method will only add a header if the message has been loaded or saved first. You do not need to call save() after this method.

convertInlineImages()

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

getAttachments()

Returns an array of all the attachment IDs on the message.
Returns: CRMScript.Global.Integer[] - Array of attachment IDs.

getValue(String)

Returns the value a column.
Returns: CRMScript.Global.String - A string value of the column.
Possible columns:
  • ticketId: Integer, The ticket this message is a child of.
  • customerId: If the message was created by email or from the customer center, this field will point to that customer. -1 if the message was created by an user
  • createdAt: Datetime when the message was created.
  • createdBy: Integer, The ID of the user who posted the message. The value 1 (system user) for externally posted messages.
  • type: String, The type of the message (plaintext/html).
  • searchTitle: A copy of the title of the ticket, for search optimisation and simpler reporting.
  • author: String, A string representing the author of the message. Could be a user’s name, or a persons email address.
  • slevel: String, The securitylevel of the message (1 is internal, 2 is external).
  • messageId: String, The X-Message-Id header value from the email. Used for threading, i.e. connecting messages to existing tickets.
  • timeSpent: Integer, The time spent (minutes) for this message.
  • emailHeader: The email header is saved in this field as raw text
  • debugInfo: The debug info for the message.
  • important: True if this message is important.
  • mailSorter: The name of the mail sorter used when the email was imported. Note: We must use name instead of id since the id’s change every time one changes the mail sorter.
  • inlineImages: True if message contains inline images.
  • htmlBodyInlineConverted: True if the html_body has converted inline image links.
  • inlineConverted: True if the html_body has converted inline image links.
  • body: String, The textbody for the message.
  • bodyHtml: String, The HTML body for the message (if any).
  • badge: String, defines the initial source of message. See <xref href=“CRMScript.NetServer.BadgeType” data-throw-if-not-resolved=“false”></xref>.
  • x_… : Extra fields

load(Integer)

Loads the message with the given ID.
Returns: CRMScript.Global.Bool - True if successful; otherwise, false.

save()

Saves a message and returns the database ID.
Returns: CRMScript.Global.Integer - The database Id.
You can optionally add logging.

save(String)

Saves a message and returns the database ID.
Returns: CRMScript.Global.Integer - The database Id.
Use save() if you don’t want to add logging.

save(String.Bool)

Saves a message and returns the database ID.
Returns: CRMScript.Global.Integer - The database Id.
Use save() if you don’t want to add logging.

saveInvolved(String)

Saves the email address of a single recipient of a message.
Returns: CRMScript.Global.Void
Use save(Vector) to save a collection of addresses.

saveInvolved(Vector)

Saves the email address of a single recipient of a message
Returns: CRMScript.Global.Void
Use save(String) to save a single email address.

send(Vector,Vector,Vector)

Sends an email version of the message to the main contacts on the parent ticket.
Returns: CRMScript.Global.Bool - True if everything is OK; otherwise, false.
Use one of the other variants if you want to merge with reply template or set subject and a heading for the body part.

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.
Returns: CRMScript.Global.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
Returns: CRMScript.Global.Bool - True if everything is OK; otherwise, false.
You can optionally provide a heading for the body part.

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.
Returns: CRMScript.Global.Bool - True if everything is OK; otherwise, false.
The body heading may be empty for no heading, or null for default heading (same as not using this parameter).

sendFacebook()

Posts message to Facebook
Returns: CRMScript.Global.Void

sendSms(Vector)

Sends an sms-version of the message to the numbers in the vector.
Returns: CRMScript.Global.Bool - True if successful; otherwise, false.

setAttachments(Vector)

Connects the attachments to the message.
Returns: CRMScript.Global.Void
You must do a message.save before message.setAttachments.

setValue(String,String)

Sets the value of column colName to the given value
Returns: CRMScript.Global.Void
Possible columns:
  • ticketId: Integer, The ticket this message is a child of.
  • customerId: If the message was created by email or from the customer center, this field will point to that customer. -1 if the message was created by an user
  • createdAt: Datetime when the message was created.
  • createdBy: Integer, The ID of the user who posted the message. The value 1 (system user) for externally posted messages.
  • type: String, The type of the message (plaintext/html).
  • author: String, A string representing the author of the message. Could be a user’s name, or a persons email address.
  • slevel: String, The securitylevel of the message (1 is internal, 2 is external).
  • messageId: String, The X-Message-Id header value from the email. Used for threading, i.e. connecting messages to existing tickets.
  • timeSpent: Integer, The time spent (minutes) for this message.
  • emailHeader: The email header is saved in this field as raw text
  • debugInfo: The debug info for the message.
  • important: True if this message is important.
  • mailSorter: The name of the mail sorter used when the email was imported. Note: We must use name instead of id since the id’s change every time one changes the mail sorter.
  • inlineImages: True if message contains inline images.
  • body: String, The textbody for the message.
  • bodyHtml: String, The HTML body for the message (if any).
  • badge: String, defines the initial source of message. See <xref href=“CRMScript.NetServer.BadgeType” data-throw-if-not-resolved=“false”></xref>.
  • x_… : Extra fields

toParser(Parser)

This function loads many fields of the message to the input parser.
Returns: CRMScript.Global.Void
The fields will be loaded as message.value
  • message.id, The ID of the message
  • message.slevelInteger, The security level of the message. See <xref href=“CRMScript.NetServer.TicketSecurityLevel” data-throw-if-not-resolved=“false”></xref>.
  • message.slevel, The security level of the message as a String, according to the active user’s language.
  • message.createdAt, The datetime when the message is created in format 12. jan 1998, kl. 11:23.
  • message.createdAtRaw, The datetime when the message is created in format 1998-01-12 11:23:15
  • message.author, The author of the message
  • message.bodyHtml, The HTML body of the message
  • message.messageCategory, The message category. See <xref href=“CRMScript.NetServer.TicketMessageCategory” data-throw-if-not-resolved=“false”></xref>.
  • message.body, The body of the message, if this is a plaintext message, this text will be returned with activated links
  • message.bodyPlain, The body of the message exactly as saved in database.
  • message.header, The message header
  • message.mailSorter, If this message is a recieved mail, the this is the name of the mail filter that took it.
  • message.x_myextrafield, The value of the extrafield