[rt-users] Create a prep action based on custom header
Kevin Squire
gentgeen at wikiak.org
Wed Feb 6 11:12:50 EST 2008
I have a webform that submits an email into RT. I have a scrip that I want
to run ONLY if the email came from the webform. I currently have the scrip
set up, and all is working - but it works on EVERY email that comes in. I
would like to add a check so that if the email came from somewhere other
then the web form, then the rest scrip can be by-passed. With my webform, I
have added an X-header -- "X-Webform: yes"
>From reviewing the archives, It appears as though I can place this check
into the prep code. From what I found on the list, I have put the following
prep code together. But since my Perl skills are zero to null I wanted to
run it by the list:
Prep Code:
my $Trans = $self->TransactionObj;
my $submitted = $Trans->Attachments->First->GetHeader('X-Webform') =~
/^yes\b/ ;
# if the X-webform is yes then do magic
if ( $submitted = yes )
{
return 1;
} else {
return 0;
}
So, for the scrip edit page I currently have this:
Condition: On Create
Action: User Defined
Template: Global template:Blank
Stage: TransactionCreate
Custom condition: BLANK
Custom action prep. code: currently it has "return 1;" but I would like
to add the check
Custom action cleanup code: "My Magic"
So my questions are:
1) Is my logic right - by adding a "return 1 if or return 0" type statement
to the prep condition will I by-pass the cleanup code?
2) Is my prep code noted above "good" or is my lack of Perl showing through?
--
http://gentgeen.homelinux.org
#############################################################
Associate yourself with men of good quality if you esteem
your own reputation; for 'tis better to be alone then in bad
company. - George Washington, Rules of Civility
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20080206/00f5ec89/attachment.htm>
More information about the rt-users
mailing list