SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
V-parameters for e-mail trigger not working?

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
V-parameters for e-mail trigger not working?
Author Message
barefootguru



Joined: 10 Aug 2007
Posts: 195

Post V-parameters for e-mail trigger not working? Reply with quote
I'm wanting to use the @V parameters in a JavaScript to pick up the details of the e-mail which triggered a job.

@V"subject" is working in the command line when calling up a DOS batch file but not within a JavaScript job:

The first four V parameters in here always return nulls to the log, the T works as expected:

Code:

var subject='@V"subject"';
var message='@V"message"';
var sender='@V"sender"';
var attachments='@V"attachments"';

var t='@T"yyyymmdd"';

Scheduler.logAddMessage('INFO', @V"job_id", '@V"job_name"', 'subject='+subject+' message='+message+' sender='+sender+' attachments='+attachments+ ' t='+t);


The log shows:

Code:

166   pop test   subject= message= sender= attachments= t=20080722


What have I missed? (And yes there is a subject, sender, and body to the message)

MP 4.1 255
Tue Jul 22, 2008 2:03 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7949

Post Reply with quote
Maybe the job is set to run detached and cannot access the scheduler process, which knows parameters of the email that has triggered the job. Please check if unsetting the detached property solves the issue.
Tue Jul 22, 2008 8:37 am View user's profile Send private message
barefootguru



Joined: 10 Aug 2007
Posts: 195

Post Reply with quote
Thanks, that's fixed the null variables (you might want to note that in the User's Guide).

But for 'message' I'm now receiving:

Quote:
An error occurred while executing automation script: Line 2: unterminated string literal


I'm wondering if 24x7 is adding quotes when resolving @V"message"? Is there a way to make this quote-safe no matter what the message body is?
Tue Jul 22, 2008 10:22 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7949

Post Reply with quote
Essentially @V are simple substitution macros, in other words, in run-time, @V tags are replaced with the values as is, before the updated script is executed. Quoting is of course an issue, if you don't know what type of quotes are used in the values, single or double, or if the quotes can be of any type. As long as you know the type and that type is consistent, you can use the opposite quote type as a string delimiter for the values.

For example:
Code:
var some_var = "my message is injected here @V"message"";
var some_var = 'my message is injected here @V"message"';


in both cases @V"message" is substituted with the message text. If that text contains double quotes, the first statement is going to fail. If that text contains single quotes, then the second statement is going to fail.

A workaround for that issue is to set "save attachments" job property and then in the job script read message text from message.txt file using the available file reading functions.
Tue Jul 22, 2008 10:45 pm View user's profile Send private message
barefootguru



Joined: 10 Aug 2007
Posts: 195

Post Reply with quote
OK, thanks. I'll have to read the message.txt file.
Wed Jul 23, 2008 2:29 am View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.