I'm trying to get the "Assign to:" drop down box to default to the current agents name when opening a new ticket. This would help make the ticket opening process more efficient when the current agent will be the owner of the ticket, yet still leave the option to assign the ticket to a different agent.has anyone completed this successfully?Below is a copy paste of the unaltered code for the "Assign To:" box on the New Ticket page. It almost seems like it's already built to do that (highlighted??), however it does not work for us.Thanks so much for any advice!include/staff/ticket-open.inc.php<?php        if($thisstaff->hasPerm(TicketModel:, false)) { ?>        <tr>            <td width="160"><?php echo __('Assign To');?>:</td>            <td>                <select id="assignId" name="assignId">                    <option value="0" selected="selected">&mdash; <?php echo __('Select an Agent OR Team');?> &mdash;</option>                    <?php                    if(($users=Staff:())) {                        echo '<OPTGROUP label="'.sprintf(__('Agents (%d)'), count($users)).'">';                        foreach($users as $id => $name) {                            $k="s$id";                            echo sprintf('<option value="%s" %s>%s</option>',                                        $k,(($info==$k)?'selected="selected"':''),$name);                        }                        echo '</OPTGROUP>';                    }osTicket v. 1.10.1php 5.6IIS10

Highlighted does not do it, what you want. It fill the dropdown box with names. 

okay perfect thanks.does anyone know how to change the "selected" to the current agent?I feel like I've gotten so close with $thisstaff, but I just can't get it.

It must be $thisstaff->getName() for staff name and $thisstaff->getId() for ID.If I understand it right, this dropdown is evaluated in file \include\class.ticket.php near line 3504: if ($vars).Write the name directly in \include\staff\ticket-open.inc.php is easy, but if I make it, the value is not send. Unfortunately I do not know what's wrong.

PavelH. U Da Bomb.It's not perfect, but totally works for now.Replace this        <select id="assignId" name="assignId">            <option value="0" selected="selected">&mdash; <?php echo __('Assign to Me');?> &mdash;</option>With this<select id="assignId" name="assignId">        <?php        $d=$thisstaff->getid();                $t="s$d";                echo sprintf('<option value="%s" selected="selected">Assign to Me</option>', $t);           ?>This makes the default list option "Assign to Me" and assigns the ticket to the current Agent if left unchanged.

2 months later

Hello ScoFlo

Can you please give more details about your custom code. Which line in which file we should change?
Can you attache the whole file of possible?

Thank you

Write a Reply...