Add custom field to database in osticket

1.1k Views Asked by At

I am trying to learn osticket. I am adding a new custom field to be shown on frontend. I have changed the file open.inc.php with adding the following code

<tr><td colspan="2"><hr />
    <div class="form-header" style="margin-bottom:0.5em">
    <b><?php echo __('Location'); ?></b>
    </div>
</td></tr>
<tr>
    <td colspan="2">
        <select id="location" name="location" onChange="fetch_select(this.value)">
            <option value="" selected="selected">&mdash; <?php echo __('Select a State');?> &mdash;</option>
            <option value='Jalandhar'>Jalandhar</option>
        </select>

    </td>
</tr>

But nowhere I am able to find the code to add this data to database.

Please guys help me in osticket how I can add this field to database ?

2

There are 2 best solutions below

0
On

You should definitely use the built-in functionality for this purpose because it works perfectly, I only recommend you take into account that in an upgrade the custom aggregate fields were perfectly maintained and the OsTicket continues to work wonderfully, but the pre-existing records in the database data left with custom aggregate fields blank... show as "empty"

0
On

Although you could probably do it this way, osTicket actually has a built-in functionality called "Forms" that allows you to customize your ticket form in whatever way you see fit. Go check that out in the admin under the Forms Setting screen and you can add a select box like what you show in your example.

I recommend you use the built-in functionality instead.