Create and update requests

Void setValue(String colName, String value)

Sets a named field to the given value. Look up names in the reference section down below, or check out the class reference.

๐Ÿ›ˆ Note
Both parameters are strings! Remember to use quotes even for IDs.
Ticket t;
t.setValue("title", "No audio");
t.setValue("category", "2");
t.setValue("status", "1");
t.setValue("priority", "2");
print(t.save().toString());

This snippet creates a new ticket and prints its ID.

๐Ÿ›ˆ Tip
To check the available options for category, status, and priority: Go to the SuerOffice Admin client and select Requests from the main menu. You can now inspect the options in each tab.

Frequently used ticket values

ParameterDb fieldDescription
titletitleA descriptive name, String
categorycategoryThe ID of the category the ticket belongs to
ownedByowned_byThe ID of the user who owns the ticket
slevelslevelThe security level of the ticket (1: internal, 2: external)
prioritypriorityThe ID
statusstatusThe main ticket status [0-5]
custIdcust_idThe ID of the primary customer
customersticket_customersA comma-separated list of customer IDs
createdBycreated_byThe ID of the user who posted the ticket (1: system)

For a complete list of fields, see the database reference.

Integer save()

Saves a new or updated ticket and returns its ID.

Ticket t;
t.setValue("title", "No audio");
t.save();

Integer save(String log)

A variant of save() that also adds a message to the ticket log.

Ticket t;
t.setValue("title", "No audio");
t.save("This is the 5th audio complaint in 1 hour!");

Integer save(Bool setReadStatus, Bool doNotCheckEscalating)

A variant of save() with 2 settings for controlling processing:

  • setReadStatus: if true, update the read status
  • doNotCheckEscalating: if true, do NOT let the update trigger a possible escalation
Ticket t;
t.setValue("title", "No audio");
t.save(true, false);

Integer save(String log, Bool setReadStatus, Bool doNotCheckEscalating)

A variant of save() that combines the processing settings and a log message.

Ticket t;
t.setValue("title", "No audio");
t.save("audio",true, true);