[rt-users] Set CustomField from scrip action

Ken Crocker kfcrocker at lbl.gov
Thu Apr 9 14:13:49 EDT 2009


    Try changing your code to add the custom field value like this:

$self->TicketObj->AddCustomFieldValue( Field => $cf, Value => 'yes', RecordTransaction=>0 );

    Also, make sure the values you are using are correct in terms of 
case. "Yes" is not the same as "yes" and if the values you allow for the 
CF has "Yes" and NOT "yes", then it won't work. Same for the CF name.

    Hope this helps.


On 4/8/2009 5:36 PM, Nick Kartsioukas wrote:
> Okay, I'm doing something wrong, and I'm just getting over a bad cold so
> my brain isn't all here.  I'm trying to set a CustomField value from
> within a scrip.  I've watched the debug output and the scrip is run, but
> the CustomField value is still null.  CF is named 'createdbyemail', set
> as a select one value type, with a possible value of 'yes'.  Scrip
> action:
> my $cf = RT::CustomField->new( $RT::SystemUser );
> $cf->LoadByName( Name => 'createdbyemail' );
> $self->TicketObj->AddCustomFieldValue( Field => $cf, Value => 'yes' );
> return 1;
> I can't even remember how I got started with this particular chunk of
> code (I'm pretty sure I stole it from something in the contributed
> scrips area of the wiki)...help would be appreciated.  Thanks!
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
> Community help: http://wiki.bestpractical.com
> Commercial support: sales at bestpractical.com
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
> Buy a copy at http://rtbook.bestpractical.com

More information about the rt-users mailing list