OTRS 8.0 API Reference Perl

Description manuals and libraries
OTRS 8.0 API Reference Perl > Perl Modules > Kernel::System::ProcessManagement::Modules::TicketArticleCreate

NAME

Kernel::System::ProcessManagement::Modules::TicketArticleCreate - A module to create an article

DESCRIPTION

All TicketArticleCreate functions.

PUBLIC INTERFACE

new()

Don't use the constructor directly, use the ObjectManager instead:

    my $TicketArticleCreateObject = $Kernel::OM->Get('Kernel::System::ProcessManagement::Modules::TicketArticleCreate');

Run()

    Run Data

    my $TicketArticleCreateResult = $TicketArticleCreateActionObject->Run(
        UserID                     => 123,
        Ticket                     => \%Ticket,   # required
        ProcessEntityID            => 'P123',
        ActivityEntityID           => 'A123',
        SequenceFlowEntityID       => 'T123',
        SequenceFlowActionEntityID => 'TA123',
        Config => {
            SenderType           => 'agent',                            # (required) agent|system|customer
            IsVisibleForCustomer => 1,                                  # 0 or 1
            CommunicationChannel => 'Internal',                         # Internal|Phone|Email|..., default: Internal

            %DataPayload,                                               # some parameters depending of each communication channel, please check ArticleCreate() on each
                                                                        #   communication channel for the full list of optional and mandatory parameters

            TimeUnit => 123,                                            # optional, to set the accounting time
            UserID   => 123,                                            # optional, to override the UserID from the logged user

            # specific for <OTRS_AGENT_BODY_RICHTEXT> / <OTRS_CUSTOMER_BODY_RICHTEXT> OTRS smart tags:
            AgentBodyRichTextQuote    => 0,                             # optional, 0 or 1, insert the last agent article as quote like 'AgentTicketCompose' frontend
            CustomerBodyRichTextQuote => 0,                             # optional, 0 or 1, insert the last customer article as quote like 'AgentTicketCompose' frontend

            AgentBodyRichTextInlineImagesInclude    => 0,               # optional, 0 or 1, inline attachments of the last agent article are taken over to the new article
            CustomerBodyRichTextInlineImagesInclude => 0,               # optional, 0 or 1, inline attachments of the last customer article are taken over to the new article

            AgentBodyRichTextAttachmentsInclude    => 0,                # optional, 0 or 1, all attachments of the last agent article are taken over to the new article
            CustomerBodyRichTextAttachmentsInclude => 0,                # optional, 0 or 1, all attachments of the last customer article are taken over to the new article
        },
    );

    Ticket contains the result of TicketGet including DynamicFields
    Config is the Config Hash stored in a Process::SequenceFlowAction's  Config key
    Returns:

    $TicketArticleCreateResult = 1; # 0

    Internal article example:

    my $TicketArticleCreateResult = $TicketArticleCreateActionObject->Run(
        UserID => 123,
        Ticket => {
            TicketNumber => '20101027000001',
            Title        => 'some title',
            TicketID     => 123,
            State        => 'some state',
            # ... (all ticket properties)
        },
        ProcessEntityID            => 'P123',
        ActivityEntityID           => 'A123',
        SequenceFlowEntityID       => 'T123',
        SequenceFlowActionEntityID => 'TA123',
        Config                     => {
            SenderType           => 'agent',
            IsVisibleForCustomer => 1,
            CommunicationChannel => 'Internal',

            # Internal article data payload.
            From           => 'Some Agent <email@example.com>',
            To             => 'Some Customer A <customer-a@example.com>',
            Subject        => 'some short description',
            Body           => 'the message text',
            Charset        => 'ISO-8859-15',
            MimeType       => 'text/plain',
            HistoryType    => 'OwnerUpdate',
            HistoryComment => 'Some free text!',
            UnlockOnAway   => 1,
        },
    );

    Email article example:

    my $TicketArticleCreateResult = $TicketArticleCreateActionObject->Run(
        UserID => 123,
        Ticket => {
            TicketNumber => '20101027000001',
            Title        => 'some title',
            TicketID     => 123,
            State        => 'some state',
            # ... (all ticket properties, as the result from Kernel::System::Ticket::TicketGet)
        },
        ProcessEntityID            => 'P123',
        ActivityEntityID           => 'A123',
        SequenceFlowEntityID       => 'T123',
        SequenceFlowActionEntityID => 'TA123',
        Config                     => {
            SenderType           => 'agent',
            IsVisibleForCustomer => 1,
            CommunicationChannel => 'Email',

            # Email article data payload.
            From             => 'Some Agent <email@example.com>',
            To               => 'Some Customer A <customer-a@example.com>',
            Subject          => 'some short description',
            Body             => 'the message text',
            Charset          => 'ISO-8859-15',
            MimeType         => 'text/plain',
            HistoryType      => 'EmailAgent',
            HistoryComment   => 'Some free text!',
            UnlockOnAway     => 1,
        }
    );

    Chat article example:

    my $TicketArticleCreateResult = $TicketArticleCreateActionObject->Run(
        UserID                   => 123,
        Ticket                   => {
            TicketNumber => '20101027000001',
            Title        => 'some title',
            TicketID     => 123,
            State        => 'some state',
            # ... (all ticket properties, as the result from Kernel::System::Ticket::TicketGet)
        },
        ProcessEntityID            => 'P123',
        ActivityEntityID           => 'A123',
        SequenceFlowEntityID       => 'T123',
        SequenceFlowActionEntityID => 'TA123',
        Config                   => {
            SenderType           => 'agent',
            IsVisibleForCustomer => 1,
            CommunicationChannel => 'Chat',

            # Chat article data payload.
            ChatMessageList => [
                {
                    ID              => 1,
                    MessageText     => 'My chat message',
                    CreateTime      => '2014-04-04 10:10:10',
                    SystemGenerated => 0,
                    ChatterID       => '123',
                    ChatterType     => 'User',
                    ChatterName     => 'John Doe',
                },
                # ...
            ],
            HistoryType    => 'Misc',
            HistoryComment => 'Some free text!',
        }
    );