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

Behzad Mahini bmahini at apple.com
Thu Aug 25 16:48:19 EDT 2011


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)






Thanks,
Behzad



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20110825/772ec82c/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PastedGraphic-2.pdf
Type: application/pdf
Size: 41275 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20110825/772ec82c/attachment.pdf>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20110825/772ec82c/attachment-0001.htm>


More information about the rt-users mailing list