#816 closed defect (fixed)
Custom Fields in E-Mail notification
Reported by: | ivo.looser at login . ch | Owned by: | Christian Boos |
---|---|---|---|
Priority: | normal | Milestone: | 0.12.4 |
Component: | ticket system | Version: | devel |
Severity: | normal | Keywords: | verify, custom, fields, notification, msoutlook |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
The Custom Fields should also displayd in E-Mail notification.
Attachments (0)
Change History (21)
comment:1 by , 20 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 20 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:3 by , 13 years ago
So what's the syntax for adding custom fields in an email template? I can't seem to find this anywhere,
-Garrett
comment:4 by , 13 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Can someone please show an example of how to incorporate custom fields into the notification email template? There isn't any documentation on this that I can find and I'm having a hard time figuring this out. Thanks in advance,
-Garrett
comment:5 by , 13 years ago
There's nothing special to configure, if you have custom fields defined they will just show up in the notification email.
Can you be more precise about what's happening on your side?
Note that it wouldn't hurt if we would drop a line about this in the TracTicketsCustomFields page.
comment:6 by , 13 years ago
Thanks for your reply. I have multiple custom fields added to my environment's config file which are displaying/working properly on the site. It's not the case, however, that they are automatically added to the email notifications. Seems to me the email template needs to be customized to show these fields, but I can't figure out how. I'm using Trac 0.12
-Garrett
comment:7 by , 13 years ago
Keywords: | verify custom fields notification added |
---|---|
Milestone: | 0.8 → 0.12.4 |
Owner: | changed from | to
Status: | reopened → new |
Ok, so either my assumption was wrong, or there's a bug ;-)
My comment was based on the fact that here for t.e.o we get the Release Notes and API Changes fields in the ticket notification mails without doing anything special to get them (and that's even a bit annoying when they're empty).
comment:8 by , 13 years ago
All good, I appreciate you helping out. So it sounds like you're using custom fields in your email template? Do you have access to the code? And if so would you be able to post it here? Of course it would be great for a future release to have more support for this, or maybe even better documentation would be sufficient.
-G
comment:10 by , 13 years ago
... Severity: normal | Resolution: Keywords: verify custom fields notification | Quicktest: 1 -----------------------------------------------+---------------------
Didn't do anything special, the custom field was just included as part of the $ticket_props
(see TracNotification#Customizingthee-mailcontent).
So again, maybe it would help if you could show us your [ticket-custom]
configuration, and then we could try to reproduce the issue you're seeing.
follow-up: 12 comment:11 by , 13 years ago
Replying to cboos:
Let's see…
Oh please… Using a production Trac instance for testing… Tsk tsk tsk… ;)
comment:12 by , 13 years ago
comment:13 by , 13 years ago
The fields are being added on the fly to my tickets, just not the emails. Here's my [ticket-custom] config:
[ticket-custom] analytics = textarea analytics.cols = 30 analytics.label = Analytical Tracking Code due_by = text due_by.label = Date Needed by email_confirm = text email_confirm.label = Confirm via Email to mockups_attached = text mockups_attached.label = Mockups Path ticket_status = select ticket_status.label = Ticket Status ticket_status.options = New|Development|Ready for Review|In Review|Fix Requested|Ready to Deploy|Deployed
And here's how my email looks (using default template):
#189: Trac Email Change Comment (by rob): just working on adding those fields.. -------------------------------------------------------------------------- Reporter: rob Owner: bob Type: Misc Status: new Priority: Medium Component: Misc Resolution: Keywords: -------------------------------------------------------------------------- -- Ticket URL: <> Web Team <> Ongoing web projects.
comment:14 by , 13 years ago
Two things:
- this doesn't look like the default template (the comment comes first in your case, and you have a single column table); you must have a customization somewhere, look in
<tracenv>/templates
for example - you know that the workflow is configurable now, right? You don't need to abuse a custom field ticket_status for this, see TracWorkflow.
comment:15 by , 13 years ago
Wow I feel dumb, you're right the default email template was being overwritten in my environment's template directory. I didn't know that was added. That solved it, thanks so much. I will check out that Workflow link you sent as well.
-G
comment:16 by , 13 years ago
So here's what happened, we were using the fix for MS Outlook found here http://trac.edgewall.org/wiki/TracNotification#Customizingthee-mailcontent
However it seems that that eliminates the custom field functionality, is there a fix that still supports custom fields in this case? Thanks,
-G
comment:17 by , 13 years ago
The 2nd part of that instruction is about formatting the text for MS Outlook.
It contains a piece of code that will go into your e-mail template, that originally filters out all fields except those stated by
sel = ['Reporter', 'Owner', 'Type', 'Status', 'Priority', 'Milestone', 'Component', 'Severity', 'Resolution', 'Keywords']
Here you may add any other field(s) you want to populate in the mail.
Or you could try to remove the filter completely, the whole 2nd part should become:
-------------------------------------------------------------------------- {% with pv = [(a[0].strip(), a[1].strip()) for a in [b.split(':') for b in [c.strip() for c in ticket_props.replace('|', '\n').splitlines()[1:-1]] if ':' in b]]; %}\ ${'\n'.join('%s\t%s' % (format(p[0]+':', ' <12'), p[1]) for p in pv)} {% end %}\ --------------------------------------------------------------------------
(With reservations, I cannot test this myself since I don't have access to a Trac env. connected to a mail server at the moment.)
follow-up: 19 comment:18 by , 13 years ago
I've updated TracNotification@72 explaining how to add custom tickets fields to MS Outlook-formatted mails.
follow-up: 20 comment:19 by , 13 years ago
Replying to mrelbe:
I've updated TracNotification@72 explaining how to add custom tickets fields to MS Outlook-formatted mails.
Thanks! I was able to figure that out after reading the old documentation and using some logic, but your amendments help a lot. I'd say this ticket is fixed, but I won't close cause I'm not that bold.
-G
comment:20 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:21 by , 8 years ago
Keywords: | msoutlook added |
---|
Fixed in [1031].