Class Category
For accessing and changing a ticket category.
Syntax
Examples
Category c;
c.load(2); //Loads category with ID = 2
print(c.getValue("notificationEmail"));
c.setValue("name", "Bob");
Constructors
Category()
Initializes a new instance of the Category class.
Declaration
Category
Examples
Category c;
c.load(2); //Loads category with ID = 2
print(c.getValue("notificationEmail"));
c.setValue("name", "Bob");
Methods
getValue(String)
Retrieves the value of the given field in the category.
Declaration
String getValue(String field)
Parameters
Type | Name | Description |
---|---|---|
String | field | The field to get. |
Returns
Type | Description |
---|---|
String | The value of the specified field. |
Remarks
Available fields: id: The ID of the category; parent: The ID of the parent category; name: The name of the category; fullname: The full name of the category (such as "Support/Product A/bugs"); externalName: The external name of the category; categoryMaster: The ID of the category master; children: A comma-separated list of children IDs; notificationEmail: The value of the email Notification field
Examples
Category c;
c.load(2);
print(c.getValue("notificationEmail"))
load(Integer)
Load object with values from category with given ID.
Declaration
Bool load(Integer id)
Parameters
Type | Name | Description |
---|---|---|
Integer | id | The ID of the category to load. |
Returns
Type | Description |
---|---|
Bool | True if the category exists; otherwise, false. |
Examples
Category c;
c.load(2);
print(c.getValue("name"));
save()
Saves the category and returns its ID.
Declaration
Integer save()
Returns
Type | Description |
---|---|
Integer | The ID of the saved category. |
Examples
Category c;
c.load(2); //Loads category with ID = 2
print(c.getValue("notificationEmail"));
c.setValue("name", "Bob");
setValue(String,String)
Sets the value of the given field for the category.
Declaration
Void SetValue(String name, String value)
Parameters
Type | Name | Description |
---|---|---|
String | name | The field to set. |
String | value | The value to set. |
Returns
Type | Description |
---|---|
Remarks
Available fields: parent: The ID of the parent category; name: The name of the category; externalName: The external name of the category; categoryMaster: The ID of the category master; children: A comma-separated list of children IDs; notificationEmail: The value of the email Notification field
Examples
Category c;
c.load(2);
c.setValue("name", "Test");