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

2011-08-29 Thread Behzad Mahini
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 queu...@.com
 ===
 
 Subject line of email to queu...@.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


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

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

2011-08-26 Thread Payam Poursaied
Hi Behzad

As you mentioned, you want to update both on create and correspond. The scip 
parameters says it would only trigger on
correspond

Have you tried to modify the condition to On Create or clone this scrip and 
change the condition of new one to On
Create

 

I didn't go through your code but that condition make sense

 

 

  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

 



smime.p7s
Description: S/MIME cryptographic signature

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

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

2011-08-26 Thread Behzad Mahini
Thanks Payam,

But that's not the reason (though I tried  created another Scrip for the On 
Create condition as well, and that did not make any difference 
Currently:

1) my emails do come into RT, 
2) a Ticket gets generated (or an already created Ticket's content gets 
updated)
3) However, the Custom Field for the Ticket never gets updated

Trouble is, my Scrip is not even being seen by RT...and since I am not familiar 
with all the objects, my guess is I am calling the wrong object [i.e., 
(LoadByName(Name = $cf_key) could potentially be the wrong call for setting a 
Custom Field of incoming Tickets]:

#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;
}   

..Again, my Custom Fields are already defined (about 10  of them). All I need 
to do is to Update a new Ticket with the proper Custom Field, based on the 
Subject line of the Ticket.

Thanks,
Behzad
On Aug 26, 2011, at 5:30 AM, Payam Poursaied wrote:

 Hi Behzad
 As you mentioned, you want to update both on create and correspond. The scip 
 parameters says it would only trigger on correspond
 Have you tried to modify the condition to “On Create” or clone this scrip and 
 change the condition of new one to “On Create”
  
 I didn’t go through your code but that condition make sense
  
  
   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
  


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