[rt-users] Using Scrips assign CustomFields to incoming Tickets (from a pre-defined list of Custom Fields)

Behzad Mahini bmahini at apple.com
Mon Aug 29 12:32:06 EDT 2011


Any feedback on this please?

Thanks,
Behzad
On Aug 25, 2011, at 1:48 PM, Behzad Mahini wrote:

> Hi,
> 
> RT 3.6.7
> OS:	Linux
> 
> 
> Purpose:
> 
> 	Using a Scrip, I am trying to set/assign Custom Fields (from a list of pre-defined Custom Fields in Queue-A) to tickets being sent to Queue-A. 
> 
> 	My code below (Scrip) simply parses the Subject line of incoming tickets, and "should" attempt to create (& update) an incoming Ticket based on what shows up in the Subject line.
> 
> Problem:	
> 
> 	Tickets do get created as I send my emails to RT, yet they do not get set with the Custom Field (from a pre-defined set of custom fields), and Custom Field stays as "no value"
> 
> A) my Scrip parameters (using the web interface)
> ======================================
> Scrip Description:	OnCreateAddCF
> Condition:			On Correspond
> Action:				User Defined
> Template:			Correspondence-XYZ
> Stage:				TransactionCreate
> 
> 
> 	Custom condition:
> 	Custom action preparation code:
> 
> 	my %cf_hash	= (
> 		"some-text1"         =>      1,
> 		"some-text2"    	=>      1,
> 		"some-text3"         =>      1,
> 	);
> 
> 	my $cf_key;
> 
> 
> 	#Current Subject & 'Queue Name'
> 	my $t_subject	= $self->TicketObj->Subject;
> 	my $queue	= $self->TicketObj->QueueObj->Name;		#Not being used, as my Scrip is Queue-specific (being applied to Queue-A)
> 
> 	#Custom Field Name to be Set
> 	my $cf		= RT::CustomField->new(RT->SystemUser);
> 
> 	#Set Ticket's CustomField, based on Subject line!
> 	foreach $cf_key (keys %cf_hash)
> 		if (  $t_subject =~ /$cf_key/i ) {
> 			$cf->LoadByName(Name	=>	$cf_key;
> 		}	
> 	}
> 
> 	1;
> 
> Custom action cleanup code:
> 
> 
> B) My Tickets are sent via email to Queue-A at xxxx.com
> ===========================================
> 
> Subject line of email to Queue-A at xxxx.com:     Testing -- some-text2
> 
> 
> NOTES:
> 
> 1) Using the Web interface, when I try to "Reply" to the tickets that get created, my Scrip does not even show up as one of the Scrips that is being evaluated. Yet, other Scrips that I have personally created do show up as Scrips that will get triggered (shown below).
> 
> 2) My User Status: 
> 	-I am an end-user of RT, without any admin privileges on the RT system
> 	-I have the proper ACL to write, show, etc.....for Queue-A
> 	-I can successfully create tickets in Queue-A (both through email & web interface)
> 	-I can successfully create Scrips that will get triggered, based on Scrip "Action" being anything other than "User Defined" (i.e., "AutoReply To Requestors")
> 	-I don't have access to RT::Logger (based on our shop setup)
> 
> 
> <PastedGraphic-2.pdf>
> 
> 
> 
> Thanks,
> Behzad
> 
> 
> 
> --------
> RT Training Sessions (http://bestpractical.com/services/training.html)
> *  Chicago, IL, USA ˜ September 26 & 27, 2011
> *  San Francisco, CA, USA ˜ October 18 & 19, 2011
> *  Washington DC, USA ˜ October 31 & November 1, 2011
> *  Melbourne VIC, Australia ˜ November 28 & 29, 2011
> *  Barcelona, Spain ˜ November 28 & 29, 2011

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20110829/f1c5662d/attachment.htm>


More information about the rt-users mailing list