[rt-users] Error :is no longer a value for custom field
Ken Crocker
kfcrocker at lbl.gov
Tue Nov 17 14:38:34 EST 2009
Tony,
It looks like you're doing this on any create or modify transaction. So
I'll assume you're happy with your condition.
This is the way I would write the action:
Custom Prep Code:
# Set base values
my $ticket = $self->TicketObj;
my $cf_obj = RT::CustomField->new($RT::SystemUser);
my $cf_name = "WhateverItIs";
my $cf_value = "CI Entry";
# Update Custom Field
$cf_obj->LoadByName( Name => $cf_name );
$RT::Logger->debug( "Loaded \$cf_obj->Name = ". $cf_obj->Name() ."\n" );
$ticket->AddCustomFieldValue( Field=>$cf_obj, Value=>$cf_value,
RecordTransaction=>0 );
return 1;
Custom Cleanup Code:
return 1;
I Like to use $RT::Sysytemuser so I won't have a problem with privileges
on a Custom Field.
I also like to specify an actual "NAME". That way whenever I have to
debug the code, I know what the field is. I might not remember what ID
13 is.
I also like to do this in the prep code. You never know if you might
create another scrip that depends on this value being set BEFORE the
transaction has completed. This would be if you have several scrips that
run in "Batch" sequence.
Anyway, I hope this helps.
Kenn
LBNL
On 11/17/2009 10:27 AM, Tony John , Bangalore wrote:
> Hi,
> 1.Custom field is set as Select a value
>
> 2. Below mentioned is the history of actions
> Tue Nov 17 12:35:38 2009 Rukmangb - Deal Id 111 added
>
>
> # Tue Nov 17 12:35:38 2009 Rukmangb - Brand 111 added
> # Tue Nov 17 12:35:39 2009 RT_System - CI Ticket State CI New changed to CI Entry
> # Tue Nov 17 12:35:39 2009 Rukmangb - CI Ticket State CI Entry changed to CI New
> # Tue Nov 17 12:35:39 2009 RT_System - CI Ticket State CI New changed to CI Entry
> # Tue Nov 17 12:35:39 2009 Rukmangb - CI Ticket State CI Entry deleted
>
> 3.
> Custom condition:
> return 0 unless ($self->TicketObj->FirstCustomFieldValue('Deal Id') ne "" and $self->TicketObj->FirstCustomFieldValue('Brand') ne "" and
> $self->TicketObj->FirstCustomFieldValue('CI Ticket State') eq "CI New");
> return 1;
>
> Custom preparation code :
> Return 1;
>
> Custom Action clean up code :
> my( $st, $msg ) = $self->TicketObj->AddCustomFieldValue(
> Field => 13,
> Value => "CI Entry",
> RecordTransaction => 1);
> return 1;
>
>
> Regards,
> Tony John
>
> -----Original Message-----
> From: Ken Crocker [mailto:kfcrocker at lbl.gov]
> Sent: Tuesday, November 17, 2009 11:49 PM
> To: Tony John , Bangalore
> Cc: rt-users at lists.bestpractical.com
> Subject: Re: [rt-users] Error :is no longer a value for custom field
>
> Tony,
>
> A couple of questions first:
>
> 1) Does the Custom Field have Categories?
> 2) Does the Custom Field actually get updated with that value,
> regardless of error message?
> 3) what does your scrip code look like?
>
> I can't offer suggestions to code I cannot see.
>
> Kenn
> LBNL
>
> On 11/17/2009 9:52 AM, Tony John , Bangalore wrote:
>
>> Hi ,
>> Im trying to update a customfiled value using a scrip but evrytime I does it I gets this error "is no longer a value for custom field value ".Any help?
>>
>> Regards,
>> Tony John
>>
>> DISCLAIMER:
>> -----------------------------------------------------------------------------------------------------------------------
>>
>> The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
>> It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in
>> this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.
>> Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of
>> this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have
>> received this email in error please delete it and notify the sender immediately. Before opening any mail and
>> attachments please check them for viruses and defect.
>>
>> -----------------------------------------------------------------------------------------------------------------------
>> _______________________________________________
>> 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
>>
>>
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20091117/d86cd73d/attachment.htm>
More information about the rt-users
mailing list