[SOLVED] How do I dynamically fill the 'To' field in a reply template?

Moderator: crythias

Locked
tz82
Znuny newbie
Posts: 4
Joined: 30 Dec 2019, 11:43
Znuny Version: 6.0.18
Real Name: Tobias Zimmer

[SOLVED] How do I dynamically fill the 'To' field in a reply template?

Post by tz82 »

Hi!

I hope, I searched both documentation and this forum thoroughly enough, but I didn't find a working solution for my problem.

I create tickets in OTRS6 via a webservice with the following postdata (variable names simplified for readability):

Code: Select all

            'Ticket' => [
                'Type'              	=> $type,
                'CustomerUser'	 => $user,
                'Priority'      	=> $priority,
                'Queue'         	=> $queue,
                'Title'         	=> $subject,
                'State'         	=> 'new',
            ],
            'Article' => [
                'Subject'       	=> $subject,
                'Body'          	=> $body,
                'From'		=> $email,
                'To'            	=> $queue,
                'ReplyTo'       	=> $email,
                'ContentType'   	=> 'text/plain; charset=utf8',
                'CommunicationChannel' => 'Email'
            ],
            'CustomRequest' => 'POST'
            
The tickets arrive nicely and by setting the CommunicationChannel to Email, the Sender Email is also displayed in both the ticket overview and the zoomed view. But when replying to the ticket, the 'To' field is always empty. It's neither filled with the Emailadress of the customerUser in the DB (which is added to the CC), nor with the 'From' address in my postData.

See here:
Bildschirmfoto 2019-12-30 um 15.32.35.png
What address SHOULD appear in the to field? And above that more importantly: Is it possible to tell the template to get the recipient adress (TO field) from my postdata?

I also know about dynamic fields, but I could only find out about writing the submitted dynamic data into the template body.

Help would be very greatly appreciated!
You do not have the required permissions to view the files attached to this post.
Last edited by tz82 on 03 Jan 2020, 09:35, edited 1 time in total.
zzz
Znuny superhero
Posts: 914
Joined: 15 Dec 2016, 15:13
Znuny Version: All
Real Name: Emin
Company: Efflux GmbH
Contact:

Re: How do I dynamically fill the 'To' field in a reply template?

Post by zzz »

Hey,

Without taking a deeper look: try adding 'SenderTypeID' => 3 to Article.

Best regards
Emin
Professional Znuny and OTRS services: efflux.de | efflux.de/en/

Free and premium add-ons: German | English
tz82
Znuny newbie
Posts: 4
Joined: 30 Dec 2019, 11:43
Znuny Version: 6.0.18
Real Name: Tobias Zimmer

Re: How do I dynamically fill the 'To' field in a reply template?

Post by tz82 »

zzz wrote: 31 Dec 2019, 13:33 Without taking a deeper look: try adding 'SenderTypeID' => 3 to Article.
Thank you SO much! That solved it.

Do you know, if this information is anywhere in the documentation? I want to make sure I didn't just overlook important parts of the documentation...

Again: Thank you for the fast help!
zzz
Znuny superhero
Posts: 914
Joined: 15 Dec 2016, 15:13
Znuny Version: All
Real Name: Emin
Company: Efflux GmbH
Contact:

Re: [SOLVED] How do I dynamically fill the 'To' field in a reply template?

Post by zzz »

We're welcome =)

I don't think that this one is documented.
OTRS just has an unnecessarily complicated way of working with articles/replies.
Once you understand it, it gets easier to work with the API.

Best regards
Emin
Professional Znuny and OTRS services: efflux.de | efflux.de/en/

Free and premium add-ons: German | English
Locked