<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Tony,<br>
<br>
It looks like you're doing this on any create or modify transaction. So
I'll assume you're happy with your condition.<br>
This is the way I would write the action:<br>
<br>
Custom Prep Code:<br>
<br>
# Set base values<br>
<br>
my $ticket = $self->TicketObj;<br>
my $cf_obj = RT::CustomField->new($RT::SystemUser);<br>
my $cf_name = "WhateverItIs";<br>
my $cf_value = "CI Entry";<br>
<br>
# Update Custom Field<br>
<br>
$cf_obj->LoadByName( Name => $cf_name );<br>
$RT::Logger->debug( "Loaded \$cf_obj->Name = ".
$cf_obj->Name() ."\n" );<br>
$ticket->AddCustomFieldValue( Field=>$cf_obj,
Value=>$cf_value, RecordTransaction=>0 );<br>
<br>
return 1;<br>
<br>
Custom Cleanup Code:<br>
return 1;<br>
<br>
I Like to use $RT::Sysytemuser so I won't have a problem with
privileges on a Custom Field.<br>
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.<br>
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.<br>
<br>
Anyway, I hope this helps.<br>
<br>
Kenn<br>
LBNL<br>
<br>
On 11/17/2009 10:27 AM, Tony John , Bangalore wrote:
<blockquote
cite="mid:B863B1878CB80042A5BE1290B8FD6BB1E5B7AB95@BLR-HCLT-EVS05.HCLT.CORP.HCL.IN"
type="cite">
<pre wrap="">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 [<a class="moz-txt-link-freetext" href="mailto:kfcrocker@lbl.gov">mailto:kfcrocker@lbl.gov</a>]
Sent: Tuesday, November 17, 2009 11:49 PM
To: Tony John , Bangalore
Cc: <a class="moz-txt-link-abbreviated" href="mailto:rt-users@lists.bestpractical.com">rt-users@lists.bestpractical.com</a>
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:
</pre>
<blockquote type="cite">
<pre wrap="">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.
-----------------------------------------------------------------------------------------------------------------------
_______________________________________________
<a class="moz-txt-link-freetext" href="http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users">http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users</a>
Community help: <a class="moz-txt-link-freetext" href="http://wiki.bestpractical.com">http://wiki.bestpractical.com</a>
Commercial support: <a class="moz-txt-link-abbreviated" href="mailto:sales@bestpractical.com">sales@bestpractical.com</a>
Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at <a class="moz-txt-link-freetext" href="http://rtbook.bestpractical.com">http://rtbook.bestpractical.com</a>
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
</body>
</html>