Class Ticket
Class for representing an SuperOffice Service Ticket.
Examples
Ticket t;
t.load(2); // Loads the ticket with id = 2
print(t.getValue("ticketStatus"));
t.setValue("title", "Test");
t.setValue("status", "1");
DateTime d; // Default value for DateTime is now
t.setValue("dbiLastModified", d.toString());
print(t.getOwnerEmail()); // Prints name and email of owner
Constructors
Ticket()
Class for representing an SuperOffice Service Ticket.
Declaration
Ticket Examples
Ticket t;
t.load(2); // Loads the ticket with id = 2
print(t.getValue("ticketStatus"));
t.setValue("title", "Test");
t.setValue("status", "1");
DateTime d; // Default value for DateTime is now
t.setValue("dbiLastModified", d.toString());
print(t.getOwnerEmail()); // Prints name and email of owner
Methods
buildEmailSubject()
returns a String composed by the Mail tag, the ticketId and the title of the ticket
Declaration
String buildEmailSubject() Returns
| Type | Description |
| String | A String composed by the Mail tag, the ticketId and the title of the ticket. |
checkEscalating(Integer)
This function does a check according to the ticket's priority and the input action. The effect of calling this function might be that the escalation stops, restarts or continues.
Declaration
Void checkEscalating(Integer action) Parameters
| Type | Name | Description |
| Integer | action | As an Integer. |
Returns
| Type | Description |
delegate()
Delegates a ticket to a user according to the rules on the category.
For this function to take effect, you have to callTicket.save().
Declaration
delegate() Returns
| Type | Description |
delegate(Integer)
Delegates a ticket to a user according to the rules on the category. You can optionally specify a user ID not to delegate to.
For this function to take effect, you have to callTicket.save().
Declaration
delegate(Integer notUser) Parameters
| Type | Name | Description |
| Integer | notUser | The ID of a user you do not want to delegate to. |
Returns
| Type | Description |
getInvolvedOnly()
Returns a comma-separated list of the email-addresses of all customers that is not a connected customer to this ticket, but who has received a message on this ticket.
Declaration
String getInvolvedOnly() Returns
| Type | Description |
| String | A comma-separated list of email-addresses. |
getMailFrom()
This function determines and returns the most appropriate from-address, when sending a mail-message on a ticket.
Declaration
String getMailFrom() Returns
| Type | Description |
| String | The most appropriate from-address specified on with address, the ticket has arrived on, the category, etc. |
getOwnerEmail()
This function returns the owner of the ticket printed as "Name" <email-addr>.
Declaration
String getOwnerEmail() Returns
| Type | Description |
| String | The owners name and email-address. |
getOwnerSms()
This function returns the cellphone number of the owner of the ticket
Declaration
String getOwnerSms() Returns
| Type | Description |
| String | The cellphone number of the owner of the ticket as a String. |
getValue(String)
Gets the value of given column name as a String
Declaration
String getValue(String colName) Parameters
| Type | Name | Description |
| String | colName | The name of the wanted column. |
Returns
| Type | Description |
| String | Returns a string representation of the wanted value. |
load(Integer)
Load ticket with given id into this object, return true if successful, false otherwise.
Declaration
Bool load(Integer id) Parameters
| Type | Name | Description |
| Integer | id |
Returns
| Type | Description |
| Bool |
log(String)
Writes a message to the ticket log. Used for logging changes and events on a ticket
Declaration
log(String message) Parameters
| Type | Name | Description |
| String | message | The message to log. |
Returns
| Type | Description |
log(String,String)
Writes a message to the ticket log. Used for logging changes and events on a ticket
Declaration
log(String who, String message) Parameters
| Type | Name | Description |
| String | who | The name of the user that made the change to log |
| String | message | The message to log. |
Returns
| Type | Description |
notifyEmail(Integer)
This function sends a notify-email (a replyTemplate) to the owner of the ticket. To use for events like new ticket, new message on ticket etc.
Declaration
Bool notifyEmail(Integer replyTemplateId) Parameters
| Type | Name | Description |
| Integer | replyTemplateId | The ID of the replyTemplate you want to send. |
Returns
| Type | Description |
| Bool |
save()
Saves the ticket and returns the database ID of the stored ticket.
Declaration
Integer save() Returns
| Type | Description |
| Integer | The ID of the saved ticket. |
save(String)
Saves the ticket and returns the database ID of the stored ticket.
Declaration
Integer save(String log) Parameters
| Type | Name | Description |
| String | log | A String that will be saved in the log of the ticket. |
Returns
| Type | Description |
| Integer | The ID of the saved ticket. |
save(Bool,Bool)
Saves the ticket and returns the database ID of the stored ticket.
Declaration
Integer save(Bool setReadStatus,Bool doNotCheckEscalating) Parameters
| Type | Name | Description |
| Bool | setReadStatus | Whether to calculate and set the read status on save. True = yes |
| Bool | doNotCheckEscalating | True if you do NOT want the changes done on the ticket to result in a possible escalation, otherwise false. |
Returns
| Type | Description |
| Integer | The ID of the saved ticket. |
save(String,Bool,Bool)
Saves the ticket and returns the database ID of the stored ticket.
Declaration
Integer save(String log,Bool setReadStatus,Bool doNotCheckEscalating) Parameters
| Type | Name | Description |
| String | log | A String that will be saved in the log of the ticket |
| Bool | setReadStatus | Whether to calculate and set the read status on save. True = yes |
| Bool | doNotCheckEscalating | True if you do NOT want the changes done on the ticket to result in a possible escalation, otherwise false. |
Returns
| Type | Description |
| Integer | The ID of the saved ticket. |
sendMessages(String,StringMatrix,Bool,String,Integer,String)
Will send the given messages just like the forward ticket functionality in the GUI. The forwarded messages are separated by a line, and the comment is placed on top of the mail.
Declaration
Bool sendMessages(String subject, StringMatrix recipients, Bool fromCust, String messages, Integer msgId, String comment) Parameters
| Type | Name | Description |
| String | subject | The mail subject, maybe ticket.title. |
| StringMatrix | recipients | String matrix with recipients |
| Bool | fromCust | Email address from ticket or customer |
| String | messages | Comma-separated list of message IDs to forward |
| Integer | msgId | ID of added 'forward' message or -1 |
| String | comment | A comment that will be above the forwarded messages. |
Returns
| Type | Description |
| Bool |
setValue(String,String)
Sets column colName to the given value. Obs: For this to actually affect the ticket, you will have to use the function save() after you have set all the values you want.
Declaration
Void setValue(String colName, String value) Parameters
| Type | Name | Description |
| String | colName | |
| String | value |
Returns
| Type | Description |
toParser(Parser)
This function will fill the variable space of the Parser with all values of the ticket. As opposed to the function toParserRaw(), the String variables title and author are in html.
Declaration
Void toParser(Parser theParser) Parameters
| Type | Name | Description |
| Parser | theParser | The parser who will be filled with ticket-values. |
Returns
| Type | Description |
toParserRaw(Parser)
This function fills the Parser with the values of the ticket. As opposed to the function toParser() who set several of the String-values as html, all these variables will be in plain text.
Declaration
toParserRaw(Parser theParser) Parameters
| Type | Name | Description |
| Parser | theParser | The parser who will be filled with ticket-values. |
Returns
| Type | Description |