NAME
Kernel::System::DynamicTicketTemplate – access to dynamic ticket templates
DESCRIPTION
All type functions.
PUBLIC INTERFACE
new()
create an object. Do not use it directly, instead use:
use Kernel::System::ObjectManager;
local $Kernel::OM = Kernel::System::ObjectManager->new();
my $DynamicTicketTemplateObject = $Kernel::OM->Get('Kernel::System::DynamicTicketTemplate');
DynamicTicketTemplateAdd()
add a new dynamic ticket template
my $ID = $DynamicTicketTemplateObject->DynamicTicketTemplateAdd(
Name => 'New Template',
Comments => 'A description of the new template',
Subject => 'The subject provided by this template',
Body => 'The text body provided by this template',
ContentType => 'text\plain', # 'text\html'
ValidID => 1,
DynamicFields => $DynamicFieldsHashRef, # optional
ServiceID => [ 3 ],
TypeID => 2,
Frontend => 'ExternalInterface', # valid values: 'AgentInterface', 'ExternalInterface', undef [undef is for BothInterfaces]
UserID => 123,
);
The hashref for the DynamicFields parameter requires a structure like this:
$DynamicFields = {
Vendor => 0 # disabled field
Model => 1 # enabled field
Serial => 2 # mandatory field
};
DynamicTicketTemplateGet()
get types attributes
my %DynamicTicketTemplate = $DynamicTicketTemplateObject->DynamicTicketTemplateGet(
ID => 34,
);
my %DynamicTicketTemplate = $DynamicTicketTemplateObject->DynamicTicketTemplateGet(
Name => 'Default Template',
);
Returns:
%DynamicTicketTemplate = (
ID => '34',
Name => 'Default Template',
Comments => 'This is a default template for new tickets',
ContentType => 'text/html',
Subject => 'Your service request',
Body => 'Dear Customer...',
ValidID => '1',
CreateTime => '2011-12-01 08:01:23',
CreateBy => '12',
ChangeTime => '2011-12-02 10:45:01',
ChangeBy => '8',
TypeID => '15',
ServiceID => '62',
DynamicFields => { # no mandatory element
Field1 => 1,
Field2 => 0
},
Frontend => 'ExternalInterface', # valid values: 'AgentInterface', 'ExternalInterface', undef [undef is for BothInterfaces]
);
DynamicTicketTemplateUpdate()
update template attributes
my $Success = $DynamicTicketTemplateObject->DynamicTicketTemplateUpdate(
TemplateID => 5,
Name => 'New Template',
Comments => 'A description of the new template',
ContentType => 'text/plain', # or 'text/html'
Subject => 'The subject provided by this template',
Body => 'The text body provided by this template',
ValidID => 1,
DynamicFields => $DynamicFieldsHashRef, # optional
ServiceID => 3,
TypeID => 2
Frontend => 'ExternalInterface', # valid values: 'AgentInterface', 'ExternalInterface', undef [undef is for BothInterfaces]
UserID => 123,
);
The hashref for the DynamicFields parameter requires a structure like this:
$DynamicFields = {
Vendor => 0 # disabled field
Model => 1 # enabled field
Serial => 2 # mandatory field
};
DynamicTicketTemplateList()
get type list
my %List = $DynamicTicketTemplateObject->DynamicTicketTemplateList(
Valid => [0,1],
Frontend => 'ExternalInterface', # valid values: 'AgentInterface', 'ExternalInterface', undef [undef is for BothInterfaces]
);
returns: a hash containing only valid templates:
%List = {
1 => 'Default Template',
2 => 'Maintenance Case',
3 => 'Customer Information',
}
my %List = $DynamicTicketTemplateObject->DynamicTicketTemplateList(
Valid => 0,
);
returns: a hash containing all (also invalid) templates:
%List = {
1 => 'Default Template',
2 => 'Maintenance Case',
3 => 'Customer Information',
}
DynamicTicketTemplateSearch()
search for dynamic ticket templates
my %TemplateList = $DynamicTicketTemplateObject->DynamicTicketTemplateSearch(
TypeID => 123, # a ticket type ID
ServiceID => 123,
Frontend => 'ExternalInterface', # valid values: 'AgentInterface', 'ExternalInterface', undef [undef is for BothInterfaces]
UserID => 123,
);
returns: a hash containing the templates that matches the criteria:
%List = {
1 => 'Default Template',
3 => 'Customer Information',
}
DynamicTicketTemplateLookup()
get id or name of a ticket template
my $TemplateName = $DynamicTicketTemplateObject->DynamicTicketTemplateLookup(
ID => $TemplateID,
NotFoundError => 0, # By default, log not found error. If set to 0, skip logging.
);
my $TemplateID = $DynamicTicketTemplateObject->DynamicTicketTemplateLookup(
Name => $TemplateName,
);
DynamicTicketTemplateDelete()
delete a Dynamic Ticket Template entry
returns 1 if successful or undef otherwise
my $Success = $DynamicFieldObject->DynamicTicketTemplateDelete(
TemplateID => 123,
UserID => 123,
);
DynamicTicketTemplateRelationDynamicFieldDelete()
delete the dynamic field relation from all dynamic ticket templates
returns 1 if successful or undef otherwise
my $Success = $DynamicFieldObject->DynamicTicketTemplateRelationDynamicFieldDelete(
DynamicFieldID => 123,
UserID => 123,
);
DynamicTicketTemplateGetUsedDynamicFields()
get the used dynamic fields from all dynamic ticket templates
my %List = $DynamicTicketTemplateObject->DynamicTicketTemplateGetUsedDynamicFields(
Frontend => 'AgentInterface', # valid values: 'AgentInterface', 'ExternalInterface',
);
returns: a hash containing the dynamic field names
%List = {
DynamicField_X => 1,
...
}
CustomerGroupDTTSet()
assign dynamic ticket templates to a customer group
returns 1 if successful or undef otherwise
my $Success = $DynamicTicketTemplateObject->CustomerGroupDTTSet(
TemplateIDs => [123, 31, 83],
GroupID => 123,
);
CustomerGroupDTTList()
provides a list of all dynamic ticket templates assigned to a customer group
returns 1 if successful or undef otherwise
my $DTTList = $DynamicTicketTemplateObject->CustomerGroupDTTList(
GroupID => 123,
);
$DTTList = {
25 => 1,
31 => 1,
84 => 1,
}
DTTCustomerGroupSet()
Assign customer groups to a dynamic ticket template. The GroupIDs parameter expects a hash, where each key is the ID of a (customer) group and each value represents the state of its assignment to the dynamic ticket template (1 = assigned, 0 = not assigned)
returns 1 if successful or undef otherwise
my $Success = $DynamicTicketTemplateObject->DTTCustomerGroupSet(
TemplateID => 123,
GroupIDs => {
54 => 1,
86 => 0,
212 => 1
},
);
DTTCustomerGroupList()
provides a hashref to list of all customer groups assigned to a dynamic ticket template
my $CustomerGroupList = $DynamicTicketTemplateObject->DTTCustomerGroupList(
TemplateID => 123,
);
$CustomerGroupList = {
2 => 1,
5 => 1,
28 => 1,
683 => 1,
};
StdAttachmentDTTMemberAdd()
to add an attachment to a dynamic ticket template
my $Success = $DynamicTicketTemplateObject->StdAttachmentDTTMemberAdd(
AttachmentID => 123,
TemplateID => 123,
Active => 1, # optional
UserID => 123,
);
StdAttachmentDTTMemberList()
returns a list of Standard Attachment / Dynamic Ticket Template members
my %List = $DynamicTicketTemplateObject->StdAttachmentDTTMemberList(
AttachmentID => 123,
);
or
my %List = $DynamicTicketTemplateObject->StdAttachmentDTTMemberList(
TemplateID => 123,
);
Returns: %List = ( 1 => 'Some Name', 2 => 'Some Name', );