Skriptbasiertes Erzeugen eines Tickets


So erstellen Sie ein neues Ticket in Skripten in der einfachsten Form, ohne Formulare oder Anhänge:

var description = "Some description with \nmultiple lines.";
var title = "New job";
var minutes = 60;
var ownerId = 23;
var adressedGroupId = 12;
var newTicketId=helper.createTask(adressedGroupId, title, description, minutes, ownerId, null, null);  

Fügen Sie dem neuen Ticket ein Formular hinzu:
Dadurch wird dem neuen Ticket das Formular Nr. 150 hinzugefügt.

var description = "Some description with \nmultiple lines.";
var title = "New job";
var minutes = 60;
var ownerId = 23;
var adressedGroupId = 12;
// register the java type of a HashMap in javascript:
var JHashMap = Java.type("java.util.HashMap");
// create the maps:
// a map of forms:
var forms=new JHashMap;
// this ist the form:
var someForm=new JHashMap;

// add field/value pairs to the form:
// make sure to use the right field names and types for your form:
someForm.put("FieldName1", "FieldVal1");
someForm.put("FieldName2", "FieldVal2");
// add the form content to the map of forms,
// use the forms Id as the key:
forms.put(new java.lang.Long(150), someForm);

// create the new ticket:
var newTicketId=helper.createTask(adressedGroupId, title, description, minutes, ownerId, forms, null);  

Erstellung eines neuen Tickets mit Anhang:

var toGroup = 201;
var owner = 223;
var minutes=60;

// create the attachment list:  
var attachmentList = new java.util.ArrayList();

// create an attachment object of type com.proxemo.todo.bom.ToDoAttachment

var JAttachment = Java.type("com.proxemo.todo4.bom.ToDoAttachment");
var attachment = new JAttachment();

// assign byte content and filename:
// var excelFile = ... // of type byte[]
attachment.setAttachmentContent(excelFile);
attachment.setAttachmentName("Kandidaten.xlsx");
// add the new attachment to the list:  
attachmentList.add(attachment);

// create ticket and pass the attachment list:
ticketId=helper.createTask(toGroup, "Some title", "Some description", minutes, owner, null, attachmentList);