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"<br>
<br>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:<br>
<br>Prep Code:<br><br> my $Trans = $self->TransactionObj; <br> my $submitted = $Trans->Attachments->First->GetHeader('X-Webform') =~ /^yes\b/ ; <br> # if the X-webform is yes then do magic<br> if ( $submitted = yes )<br>
{ <br> return 1;<br> } else {<br> return 0;<br> }<br><br><br>So, for the scrip edit page I currently have this: <br> Condition: On Create<br> Action: User Defined<br> Template: Global template:Blank<br>
Stage: TransactionCreate<br><br> Custom condition: BLANK<br> Custom action prep. code: currently it has "return 1;" but I would like to add the check<br> Custom action cleanup code: "My Magic"<br clear="all">
<br>So my questions are:<br>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?<br>2) Is my prep code noted above "good" 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 <br>
your own reputation; for 'tis better to be alone then in bad <br> company. - George Washington, Rules of Civility