No subject


Fri Jan 25 17:20:55 EST 2008


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

------=_Part_6355_25133542.1202314370659
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

I have a webform that submits an email into RT.&nbsp; I have a scrip that I want to run ONLY if the email came from the webform.&nbsp; I currently have the scrip set up, and all is working - but it works on EVERY email that comes in.&nbsp; 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.&nbsp; With my webform, I have added an X-header -- &quot;X-Webform: yes&quot;<br>
<br>From reviewing the archives, It appears as though I can place this check into the prep code.&nbsp; From what I found on the list, I have put the following prep code together.&nbsp; But since my Perl skills are zero to null I wanted to run it by the list:<br>
<br>Prep Code:<br><br>&nbsp;&nbsp; my $Trans = $self-&gt;TransactionObj;&nbsp; <br>&nbsp;&nbsp; my $submitted = $Trans-&gt;Attachments-&gt;First-&gt;GetHeader(&#39;X-Webform&#39;) =~ /^yes\b/ ; <br>&nbsp;&nbsp; # if the X-webform is yes then do magic<br>&nbsp;&nbsp; if ( $submitted = yes )<br>
&nbsp;&nbsp;&nbsp;&nbsp; { <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 1;<br>&nbsp;&nbsp;&nbsp;&nbsp; } else {<br>&nbsp; &nbsp;&nbsp;&nbsp; return 0;<br>&nbsp;&nbsp;&nbsp;&nbsp; }<br><br><br>So, for the scrip edit page I currently have this: <br>&nbsp;&nbsp; Condition: On Create<br>&nbsp;&nbsp; Action: User Defined<br>&nbsp;&nbsp; Template: Global template:Blank<br>
&nbsp;&nbsp; Stage: TransactionCreate<br><br>&nbsp;&nbsp; Custom condition: BLANK<br>&nbsp;&nbsp; Custom action prep. code: currently it has &quot;return 1;&quot; but I would like to add the check<br>&nbsp;&nbsp; Custom action cleanup code:&nbsp; &quot;My Magic&quot;<br clear="all">
<br>So my questions are:<br>1) Is my logic right - by adding a &quot;return 1 if or return 0&quot; type statement to the prep condition will I by-pass the cleanup code?<br>2) Is my prep code noted above &quot;good&quot; or is my lack of Perl showing through?<br>
<br>-- <br><a href="http://gentgeen.homelinux.org">http://gentgeen.homelinux.org</a><br><br>#############################################################<br> Associate yourself with men of good quality if you esteem&nbsp;&nbsp;&nbsp;&nbsp;<br>
 your own reputation; for &#39;tis better to be alone then in bad <br> company.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- George Washington, Rules of Civility

------=_Part_6355_25133542.1202314370659--


More information about the RT-Users mailing list