Hi,

I love the module; it just does what it says on the tin. There are a couple of features I have implemented for my personal deployments which I thought might be useful additions for the module in general. One of them is the option to pre-populate the requester e-mail address. I prefer to have the e-mail address pre-populated for my users' convenience, so the below patch gives administrators of the module the following options;

- Pre-populate the requester field with the [user:mail] token
- Pre-populate the requester field with a custom email address
- Leave the requester field blank (as it currently is)

In both pre-population options the requester field will be disabled which means the ticket requester isn't able to change the email field.

I thought I'd share the code I use in case anybody else might see the value in this.

CommentFileSizeAuthor
requester_email_1.patch5.38 KBrm-rf

Comments

perignon’s picture

Thank you so much for sharing. I think this is a great addition to the module. I will put it into dev.

  • Perignon committed ce18c70 on 7.x-1.x authored by rm-rf
    Issue #2470581 by rm-rf: Pre-populating requester email address
    
perignon’s picture

I am researching if this can also be done with the embeded form.

perignon’s picture

Wanted to mention also. Since you are heavily using the module, what do you think of the development roadmap?

perignon’s picture

Assigned: Unassigned » perignon
rm-rf’s picture

I looked into how to pass the values to the iframe code but Freshdesk doesn't seem to have any documentation on how to form the variables in this way. I'd be keen to find out if it is possible somehow though.

Viewing tickets is definitely helpful and would help my customers a lot since they wouldn't need to log into Freshdesk but can remain in Drupal to manage their day-to-day tasks and tickets. Having things like little widgets which can be placed on the dashboard to link to the tickets page would also help.

I am currently working with custom fields into the module, and thought it might be an idea to share some of these efforts once they are module-ready.

Other things which might be nice little additions are integrating with a jQuery colorpicker so the module administrator can choose the colour of the tab for instance.

perignon’s picture

Awesome. Lets start a new issue in the queue here to bring in some of this new capability. I am looking into the embed form, so far no documentation but I am going to take a stab at it by guessing variable names to see what happens.

rm-rf’s picture

Initially I had a token browser integrated with the above patch so the administrator could choose an existing token to pre-populate the requester field with but then decided against it since it really only accepts email addresses and leaves the admin under the impression that they could put all sorts of other tokens in too. Since the above patch already works with one token, [user:email], I didn't feel it warranted an entire token browser to also insert things like [site:mail], so I removed it.

perignon’s picture

It works on the embedded form too! It is the same variable names as the popup widget. They have to be put into the query string of the IFRAME src link.

I will get this added later today. I have to run for the moment.

rm-rf’s picture

That's pretty sweet, surprised this isn't better documented at Freshdesk.

  • Perignon committed ae310af on 7.x-1.x
    Issue #2470581 by rm-rf, Perignon: Pre-populating requester email...
perignon’s picture

Issue summary: View changes
Status: Needs review » Fixed

Committed the changes to allow this functionality in the embedded form as well. I also added some help text to the admin page. I noticed in testing that if you pre-populate the email field of the form Freshdesk does not allow the user to change that field. In my case this would be extremely problematic as a lot of my users never update their email account!

I may file a feature request with Freshdesk to change this behavior so the user can change the email address if it is pre-populated.

rm-rf’s picture

Hi Perignon,

All pre-populated fields should be editable retrospectively I think. The only thing that makes the field disabled is that I added in an extra parameter into the Javascript which explicitly sets it to disabled. You can do this with any field. In my case it is useful if the email address is pre-defined and you don't want end-users to change it. If you remove the '$qstring .= '&disable[requester]=true';' bit from the popup widget code, it should make it editable for the end-user.

Hope this helps

perignon’s picture

Ah! That what that setting is for. I need to make that optional. People don't update their accounts on my site and the email address is often wrong.

perignon’s picture

Status: Fixed » Needs work

Reopening because I found a problem. If the user is anonymous you don't get the $user object with an email address so it throws a notice on the site.

  • Perignon committed a828ffb on 7.x-1.x
    Issue #2470581 by rm-rf, Perignon: Pre-populating requester email...
perignon’s picture

Status: Needs work » Fixed

Think I got this fixed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

perignon’s picture