Kernel::System::FormDraft

NAME

Kernel::System::FormDraft – draft lib

SYNOPSIS

All draft functions.

PUBLIC INTERFACE

new()

create an object

    use Kernel::System::ObjectManager;
    local $Kernel::OM = Kernel::System::ObjectManager->new();
    my $FormDraftObject = $Kernel::OM->Get('Kernel::System::FormDraft');

FormDraftGet()

get draft attributes

    my $FormDraft = $FormDraftObject->FormDraftGet(
        FormDraftID    => 123,
        GetContent => 1,                # optional, default 1
        UserID     => 123,
    );

Returns (with GetContent = 0):

    $FormDraft = {
        FormDraftID    => 123,
        ObjectType => 'Ticket',
        ObjectID   => 12,
        Action     => 'AgentTicketCompose',
        CreateTime => '2016-04-07 15:41:15',
        CreateBy   => 1,
        ChangeTime => '2016-04-07 15:59:45',
        ChangeBy   => 2,
    };

Returns (without GetContent or GetContent = 1):

    $FormDraft = {
        FormData => {
            InformUserID => [ 123, 124, ],
            Subject      => 'Request for information',
            ...
        },
        FileData => [
            {
                'Content'     => 'Dear customer\n\nthank you!',
                'ContentType' => 'text/plain',
                'ContentID'   => undef,                                 # optional
                'Filename'    => 'thankyou.txt',
                'Filesize'    => 25,
                'FileID'      => 1,
                'Disposition' => 'attachment',
            },
            ...
        ],
        FormDraftID    => 123,
        ObjectType => 'Ticket',
        ObjectID   => 12,
        Action     => 'AgentTicketCompose',
        CreateTime => '2016-04-07 15:41:15',
        CreateBy   => 1,
        ChangeTime => '2016-04-07 15:59:45',
        ChangeBy   => 2,
        Title      => 'my draft',
    };

FormDraftAdd()

add a new draft

    my $Success = $FormDraftObject->FormDraftAdd(
        FormData => {
            InformUserID => [ 123, 124, ],
            Subject      => 'Request for information',
            ...
        },
        FileData => [                                           # optional
            {
                'Content'     => 'Dear customer\n\nthank you!',
                'ContentType' => 'text/plain',
                'ContentID'   => undef,                         # optional
                'Filename'    => 'thankyou.txt',
                'Filesize'    => 25,
                'FileID'      => 1,
                'Disposition' => 'attachment',
            },
            ...
        ],
        ObjectType => 'Ticket',
        ObjectID   => 12,
        Action     => 'AgentTicketCompose',
        Title      => 'my draft',                               # optional
        UserID     => 123,
    );

FormDraftUpdate()

update an existing draft

    my $Success = $FormDraftObject->FormDraftUpdate(
        FormData => {
            InformUserID => [ 123, 124, ],
            Subject      => 'Request for information',
            ...
        },
        FileData => [                                           # optional
            {
                'Content'     => 'Dear customer\n\nthank you!',
                'ContentType' => 'text/plain',
                'ContentID'   => undef,                         # optional
                'Filename'    => 'thankyou.txt',
                'Filesize'    => 25,
                'FileID'      => 1,
                'Disposition' => 'attachment',
            },
            ...
        ],
        ObjectType  => 'Ticket',
        ObjectID    => 12,
        Action      => 'AgentTicketCompose',
        Title       => 'my draft',
        FormDraftID => 1,
        UserID      => 123,
    );

FormDraftDelete()

remove draft

    my $Success = $FormDraftObject->FormDraftDelete(
        FormDraftID => 123,
        UserID  => 123,
    );

FormDraftListGet()

get list of drafts, optionally filtered by object type, object id and action

    my $FormDraftList = $FormDraftObject->FormDraftListGet(
        ObjectType => 'Ticket',             # optional
        ObjectID   => 123,                  # optional
        Action     => 'AgentTicketCompose', # optional
        UserID     => 123,
    );

Returns:

    $FormDraftList = [
        {
            FormDraftID => 123,
            ObjectType  => 'Ticket',
            ObjectID    => 12,
            Action      => 'AgentTicketCompose',
            Title       => 'my draft',
            CreateTime  => '2016-04-07 15:41:15',
            CreateBy    => 1,
            ChangeTime  => '2016-04-07 15:59:45',
            ChangeBy    => 2,
        },
        ...
    ];
Scroll to Top