Setup Ticket Form

The embeddable ticket form in SudoWorkspace is a predefined contact/support form introduced in version 1.8.0. You can add it to any website using an iframe; when a visitor submits the form, a ticket is automatically created in the CRM. Use this to let customers contact you or request support across multiple sites.

Imagine you have five websites: by embedding the form on each one, every submission will create a ticket in your SudoWorkspace. Your staff and sales agents can view these requests centrally and respond promptly. If the email provided in the form matches an existing contact in SudoWorkspace, the system will automatically associate the ticket with that customer.

To add a custom field to tickets, go to Setup → Custom Fields. Create a new custom field and set its scope to “Tickets.” A checkbox labeled “Show on ticket form” will appear at the bottom—check it to display the field on the ticket form. Don’t forget to save your changes.

The form URL can be found at Setup->Settings->Support->Ticket Form.

The system will automatically show you a sample iframe embeddable code, which you can copy and paste into your website.

Redirect User to Custom URL After Form Submission

Via FTP/cPanel go to application/helpers/ and create (if it doesn’t exist) a file my_functions_helper.php and add the following code snippet:

application/helpers/
my_functions_helper.php
add_action('ticket_form_submitted','my_ticket_form_submitted_redirect_to_custom_url');

function my_ticket_form_submitted_redirect_to_custom_url($data){ echo json_encode(array( 'success'=>true, 'redirect_url'=>'http://yourcustomurl.com' )); die; }

add_action('ticket_form_submitted','my_ticket_form_submitted_redirect_to_custom_url');

function my_ticket_form_submitted_redirect_to_custom_url($data){ echo json_encode(array( 'success'=>true, 'redirect_url'=>'http://yourcustomurl.com' )); die; }

add_action('ticket_form_submitted','my_ticket_form_submitted_redirect_to_custom_url');

function my_ticket_form_submitted_redirect_to_custom_url($data){ echo json_encode(array( 'success'=>true, 'redirect_url'=>'http://yourcustomurl.com' )); die; }

Don’t forget to include the <?php opening tag at the top of the file if it’s not already added.

<?php

Styling

If you need to style the color of the input fields to fit with your website, you can create a custom.css file in assets/css and apply the necessary styles.

custom.css
assets/css

Example changing input border color:

body.ticket_form input {
    border-color:red;
}
body.ticket_form input {
    border-color:red;
}
body.ticket_form input {
    border-color:red;
}

Example changing submit button background color:

body.ticket_form #form_submit {
    background:red;
}

body.ticket_form #form_submit:hover, body.ticket_form #form_submit:active { background:green; }

body.ticket_form #form_submit {
    background:red;
}

body.ticket_form #form_submit:hover, body.ticket_form #form_submit:active { background:green; }

body.ticket_form #form_submit {
    background:red;
}

body.ticket_form #form_submit:hover, body.ticket_form #form_submit:active { background:green; }

Passing department ID in URL (from v2.1.1)

If you are using the ticket form to a multiple URL’s where on each URL you need to send the ticket to a different department without the user that is filling the form knowing this, you can pass parameter in the ticket form URL to achieve this.

For example, imagine you have two departments—Billing and Technical Support—and the ticket form is placed on different landing pages or site sections that correspond to each department. You want submissions from the Billing page to be routed automatically to the Billing team, and submissions from the Technical page to go to Technical Support, all transparently so users don’t need to select a department or be aware of the routing.

The first step is to obtain the department ID . In the admin panel, go to Setup → Support → Departments ; the departments table displays the ID in the first column. For example, the Billing department might have ID 1.

After you get the department ID, you should modify your ticket form URL to https://your-crm-installation.com/forms/ticket? department_id=1

If you visit the URL, you will be able to see that the department field is hidden, but the Billing department will be pre-selected, and the ticket will go straight to the Billing department.

You can repeat this step for an unlimited number of departments; you will only need to change the department ID parameter.

Add custom form HTML

In application/helpers create a file my_functions_helper.php (if it doesn’t exist) and add the following code:

application/helpers
my_functions_helper.php
hooks()->add_action('ticket_form_start','my_ticket_form_start');

function my_ticket_form_start(){ echo '<img src="https://yourwebsite.com/logo.jpg">'; }

hooks()->add_action('ticket_form_start','my_ticket_form_start');

function my_ticket_form_start(){ echo '<img src="https://yourwebsite.com/logo.jpg">'; }

hooks()->add_action('ticket_form_start','my_ticket_form_start');

function my_ticket_form_start(){ echo '<img src="https://yourwebsite.com/logo.jpg">'; }

Don’t forget to include the <?php opening tag at the top of the file if it’s not already added.

<?php

Keep in mind that you will need to change the logo URL.

When placing the iframe snippet code, there are a few things you need to consider.