Description | manuals and libraries |
Kernel::System::CommunicationChannel - Functions to manage communication channels.
All functions to manage communication channels.
Don't use the constructor directly, use the ObjectManager instead:
my $CommunicationChannelObject = $Kernel::OM->Get('Kernel::System::CommunicationChannel');
Add new communication channel.
my $ChannelID = $CommunicationChannelObject->ChannelAdd(
ChannelName => 'Email', # (required) Communication channel name
Module => 'Kernel::System::CommunicationChannel::Internal', # (required) Module
PackageName => 'Framework', # (required) Package name
ChannelData => {...}, # (optional) Additional channel data (can be array, hash, scalar).
ValidID => 1, # (optional) Default 1.
UserID => 1, # (required) UserID
);
Returns:
$ChannelID = 1;
Get a communication channel.
my %CommunicationChannel = $CommunicationChannelObject->ChannelGet(
ChannelID => '1', # (optional) Communication channel id
# or
ChannelName => 'Email', # (optional) Communication channel name
);
Returns:
%CommunicationChannel = (
ChannelID => 1,
ChannelName => 'Email',
Module => 'Kernel::System::CommunicationChannel::Email',
PackageName => 'Framework',
ChannelData => {...}, # Additional channel data (can be array, hash, scalar).
DisplayName => 'Email', # Configurable
DisplayIcon => 'fa-envelope', # Configurable
ValidID => 1,
CreateTime => '2017-01-01 00:00:00',
CreateBy => 1,
ChangeTime => '2017-01-01 00:00:00',
ChangeBy => 1,
);
Update communication channel.
my $Success = $CommunicationChannelObject->ChannelUpdate(
ChannelID => '1', # (required) ChannelID that will be updated
ChannelName => 'Email', # (required) New channel name
Module => 'Kernel::System::CommunicationChannel::Internal', # (optional) Module
PackageName => 'Framework', # (optional) Package name
ChannelData => {...}, # (optional) Additional channel data (can be array, hash, scalar)
ValidID => 1, # (optional) ValidID
UserID => 1, # (required) UserID
);
Returns:
$Success = 1;
Get a list of all available communication channels.
my @CommunicationChannels = $CommunicationChannelObject->ChannelList(
ValidID => 1, # (optional) filter by ValidID
);
Returns:
@CommunicationChannels = (
{
ChannelID => 1,
ChannelName => 'Email',
Module => 'Kernel::System::CommunicationChannel::Email',
PackageName => 'Framework',
ChannelData => {...},
DisplayName => 'Email',
DisplayIcon => 'fa-envelope',
ValidID => 1,
CreateTime => '2017-01-01 00:00:00',
CreateBy => 1,
ChangeTime => '2017-01-01 00:00:00',
ChangeBy => 1,
},
{
ChannelID => 2,
ChannelName => 'Phone',
Module => 'Kernel::System::CommunicationChannel::Phone',
PackageName => 'Framework',
ChannelData => {...},
DisplayName => 'Phone',
DisplayIcon => 'fa-phone',
ValidID => 1,
CreateTime => '2017-01-01 00:00:00',
CreateBy => 1,
ChangeTime => '2017-01-01 00:00:00',
ChangeBy => 1,
},
...
);
Synchronize communication channels in the database with channel registration in configuration.
my $Result = $CommunicationChannelObject->ChannelSync(
UserID => 1,
);
Returns:
$Result = {
ChannelsUpdated => [ 'Email', 'Phone' ],
ChannelsAdded => [ 'Chat' ],
ChannelsInvalid => [ 'Internal' ],
};
Returns instance of the Channel object.
my $Object = $CommunicationChannelObject->ChannelObjectGet(
ChannelName => 'Email', # ChannelName or ChannelID required
);
my $Object = $CommunicationChannelObject->ChannelObjectGet(
ChannelID => 2, # ChannelName or ChannelID required
);
Warning: this function returns no object in case a channel is no longer available in the system, so make sure to check its return value.
Drop an invalid communication channel (that only exists in the database, but not in the configuration). By default, this will only drop channels that have no associated article data; use DropArticleData
to force article data removal as well. Channels provided by the OTRS framework can never be dropped.
my $Success = $CommunicationChannelObject->ChannelDrop(
ChannelID => 1, # (required) Delete by channel ID
# or
ChannelName => 'SomeChannel', # (required) Delete by channel name
DropArticleData => 1, # (optional) Also drop article data if possible, default: 0
);
Returns:
$Success = 1;
Delete communication channel record from the database.
my $Success = $CommunicationChannelObject->ChannelDelete(
ChannelID => 1, # (optional) Delete by ChannelID
# or
ChannelName => 'Email', # (optional) Delete by Channel name
);
Returns:
$Success = 1;
Delete communication channel cache.
my $Success = $CommunicationChannelObject->_ChannelListCacheCleanup();
Returns:
$Success = 1;
This software is part of the OTRS project (https://otrs.org/).
This software comes with ABSOLUTELY NO WARRANTY. For details, see the enclosed file COPYING for license information (GPL). If you did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.