[rt-devel] Using MassageCustomFields to select default value for customfield on new ticket from web interface

Larry Buckner design at generationtech.org
Sun Mar 30 17:50:35 EDT 2014


Hi, I'm trying to set a default for a customfield on new ticket creation 
from the web interface. I've searched and found this wiki but I'm unable 
to implement the MassageCustomFields solution described there. I 
understand how to do (and that it's easier) to set a default with an 
OnCreate scrip, but I want the default shown in advance to the web 
requestor.

http://requesttracker.wikia.com/wiki/DefaultCustomFieldValue

I have a customfield called "Urgency" defigned/assigned for tickets and 
I can see and edit the field on new ticket creation. I've entered the 
callback code from the wiki on step #3 and from adding some debug 
statements, I can see that this part is working from the event log. 
Also, between making attempted fixes, I've deleted the mson cache and 
restarted httpd.

I think my problem is in modifying the mason key store as described in 
the wiki under the example "Second, you need to go to the custom fields 
values class, and add the method that will return the default value."

Seems my questions would be:

1. If my customfield is named "Urgency," where do I place the file for 
"package RT::CustomFieldValues::CUSTOM_FIELD_NAME;"

2. I guess that part should actually be named "package 
RT::CustomFieldValues::Urgency;"

3. Since I'm already defining my customfield in the normal admin web 
interface and the values I'll use (Low, Medium, High), I am thinking the 
example in the wiki is for external lookup type customfields because it 
seems to also define the allowable values in addition to the default.

4. Can I use the modified code shown below? If so, where do I put this 
information? I'm trying to make use of the rt/local areas instead of 
changing sources.

package RT::CustomFieldValues::Urgency;

use strict;

use warnings;

use base qw(RT::CustomFieldValues);

RT::Logger->info("edit urgency custom field");

sub DefaultValue {

     return "Medium";

}

1;


Thanks in advance!


More information about the rt-devel mailing list