Edgewall Software
Modify

Opened 19 years ago

Closed 12 years ago

Last modified 7 years ago

#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 daniel, 19 years ago

Owner: changed from Jonas Borgström to daniel
Status: newassigned

comment:2 by daniel, 19 years ago

Resolution: fixed
Status: assignedclosed

Fixed in [1031].

comment:3 by anonymous, 12 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 garrett, 12 years ago

Resolution: fixed
Status: closedreopened

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 Christian Boos, 12 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 garrett, 12 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 Christian Boos, 12 years ago

Keywords: verify custom fields notification added
Milestone: 0.80.12.4
Owner: changed from daniel to Christian Boos
Status: reopenednew

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 anonymous, 12 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:9 by Christian Boos, 12 years ago

quicktest: 1

Let's see…

comment:10 by Christian Boos, 12 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.

in reply to:  9 ; comment:11 by Remy Blank, 12 years ago

Replying to cboos:

Let's see…

Oh please… Using a production Trac instance for testing… Tsk tsk tsk… ;)

in reply to:  11 comment:12 by Christian Boos, 12 years ago

Replying to rblank:

Replying to cboos:

Let's see…

Oh please… Using a production Trac instance for testing… Tsk tsk tsk… ;)

Oops… ;-)

OTOH, adding or removing a custom field on the fly is a feature ;-)

comment:13 by grimmdude, 12 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 Christian Boos, 12 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 anonymous, 12 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 garrett g, 12 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 Mikael Relbe, 12 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.)

comment:18 by Mikael Relbe, 12 years ago

I've updated TracNotification@72 explaining how to add custom tickets fields to MS Outlook-formatted mails.

in reply to:  18 ; comment:19 by anonymous, 12 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

in reply to:  19 comment:20 by Mikael Relbe, 12 years ago

Resolution: fixed
Status: newclosed

Replying to anonymous:

I'd say this ticket is fixed, but I won't close cause I'm not that bold.

But I am ;-)

Closing since the whole discussion since comment:4 turned out to be a discussion of modifying an HTML template example, which this ticket wasn't about, originally.

comment:21 by Peter Suter, 7 years ago

Keywords: msoutlook added

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.