Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

OS Ticket Survey

Morning all,

I have built a survey form but what I would ideally like to do is find a way of the link displaying 'IF' the ticket status is closed.  I have searched through the 'tickets.php' for ticket status but cannot locate where it pulls this info from.  I assume it looks at another .php page and then links in, along with grabbing the data out of mySQL.  If anyone can help me with the IF side of things for where the data is captured.

Thanks in advance.

// IF the ticket status is 'closed' then display a link to the survey.
IF ($_POST) {
  echo "Please complete the satisfaction survey <a href='survey.php'>here</a>";
  else {
    echo " ";


  • So I haven't tried to do what you are describing because we use a thirdparty survey site (think surveymonkey/surveygizmo/typeform/GoogleForms) and we put the code to link to it in a canned response.  When we close the ticket we update the ticket using the canned response.  No code required.  The user gets an update in their email with the text we want and the link.
  • We use LimeSurvey and can actually use variables to pass information from the ticket into the survey through the URL (Ticket Number, Department, etc.)
  • note: we also use variables to pass this information. :)
  • ok makes me feel there is an easier way of doing things... The reason I started to build the survey myself is that I have been advised the project needs to be at zero cost, and on looking at Lime and Survey Monkey they will both come at a cost.

    I will see if I can dig around the mySQL database / table to figure out where the data comes from to pick out if a ticket is closed.  I would then of course in a later release look for the variable to pass on the information such as ticket id and technician name.
  • LimeSurvey is free if you host it yourself. It costs us nothing to use it, but perhaps you cannot host it yourself.
  • Yeah we can host it ourselves, The only edition I could see that is free is the one with 25 responses.
  • Is it the community edition I need to be downloading in order to get it for free and to host ourselves?
  • I was thinking about this on my way in to work this morning, a wise guy once said to me that the best ideas tend to come when your not thinking about them at all...

    Can I set the IF statement mentioned above to look for the closed variable as True, and if so then display the survey link, whether this is to point to limesurvey or elsewhere.

    An example would be


    IF (%{ticket.status}
    = 'closed' ) {

    echo "Please complete our <a href="survey">Satisfaction Survey</a>";


    else {

    echo " ";


  • I have downloaded lime survey and added to our in house hosting, but until we can manage to get the IF command working, we won't be able to start pointing to the survey we would like to use.

    Can this be raised with the dev team to see if anyone can figure out the best way to approach this.  I thought it would be fairly straightforward to do the IF statement by calling the variable, the problem is that I cannot figure out what the variable is, so I used the one from the email template and that doesnt seem to be working.
  • I don't think its likely that the devs will take the time to come to the forums to help you with your mod.

    We use a canned response when closing at ticket to initiate the surveys:

    Select canned response, set status to closed/resolved/whatever, click Post Reply.

  • @blueyeguy that's what we have done also at the moment, with the canned response showing the link to the survey. 

    I would like to think that the devs would be interested in looking at a feature to integrate with Lime Survey to get the two working together through the customer portal, but maybe not. 
  • OK found a way of doing it, by adding a line of code in to with the following code:

    obviously in the live version what the echo shows is different to this.  I hope this helps someone else out there.

    if ($ticket->isClosed())
        echo "Survey.php";
  • #jhollingsworth Thx that really helped me.

    I would like to send the Survey once every X tickets.
    The users open a lot of tickets and I would not want to bother them with a survey whenever  their ticket is closed, But only every few times.

    I would be happy for some advice

    Running on: osTicket v1.10
    Web Server Apache/2.4.7 (Unix)
    MySQL 5.0.11
    PHP 5.5.12 
  • I can think of a few ways to implement something like this. 

    1. check all the tickets opened by a user and divide by X.  Where x is the number of tickets you want to count.  If the result is a whole number then send an email survey.

    example: Joan Doe has 36 tickets.  36 divided by 3 is 12.  12 is a whole number, send the email.  
                  John Doe has 32 tickets.  32 divided by 3 is 10.6666667.  which is not a whole numnber to not send the email.

    2. add a custom db column to the user table.  every time a user opens a ticket increase this number by 1.  When a ticket is closed check this number.  If the number equals your chosen number then send the email and reset the value to 0.  [This seems like a bad way to implement it and would require more coding.]

    3. Do it manually when your agent closes the ticket.
Sign In or Register to comment.