since v12.25

A CreateTicketOperationBuilder can be used to build a create-operation for a new ticket. To obtain an instance of the CreateTicketOperationBuilder call the create() Method of the TicketOperationBuilder.

An example of a method which creates a new ticket for the provided agent and the provided category and account would look like this:

private TicketOperationBuilder ticketOperationBuilder;

public Long createNewTicket(User user, Category category, Account account) {
  try {
     .with(user, category, account)
     .primaryToAddress(new InternetAddress(""))
     .additionalToAddresses(Arrays.asList(new InternetAddress("")))
     .ccAddresses(Arrays.asList(new InternetAddress("")))
     .bccAddresses(Arrays.asList(new InternetAddress("")))
     .header("X-Test1", "4711")
     .header("X-Test2", "4712")
//   .createAndSend()  // also available
//   .createAndClose() // also available
  } catch (ValidationException e) {
    // ValidationException if one of the provided attributes are not valid (e.g. null values)
  } catch (OperationFailedException e) {
    // OperationFailedException if the operation failed
  return null;