Page 1 of 2

Task status email notifications

Posted: Tue Mar 28, 2017 3:22 pm
by elwayfan446
Hello... I am new to RoboTask so I am hoping someone can help.

I want to set up a task and have it email me once it is finished to let me know the status of the task, success or failure. I was able to easily do this in an old scheduler I was using but can't seem to figure it out in RoboTask. Any help would be appreciate.

Thanks!
Scott

Re: Task status email notifications

Posted: Thu Mar 30, 2017 7:19 am
by Oleg
Read the chapter Errors handling how to use Error handling task
You can also send the alert message via email too.

To inform that the task is success put Send Email action to the end of the task.

also look at the tasks [DEMO] Error Handling Demo (Send Email with error).tsk and [DEMO] Error Handling Task.tsk to see how it works.
These tasks are already in the installation package of RoboTask.

Re: Task status email notifications

Posted: Wed Apr 26, 2017 4:55 pm
by elwayfan446
So the issue I am having now is the error description is not populating in my "Send Email" task when the task before it fails with an error. I am not sure what I am doing wrong. I have attached screenshots of my setup. The final 2 screenshots will be in a reply to this post.

Re: Task status email notifications

Posted: Wed Apr 26, 2017 4:56 pm
by elwayfan446
The remaining screenshots.

Re: Task status email notifications

Posted: Thu Apr 27, 2017 9:55 am
by Oleg
I think that the task works without error and the step #10 sent this email.
You can check the task log to analyze the process.
The variable doesn't exist at normal work and you get the string {LastErrorDescription} instead of the error description

Look at my small examples below.
1-st example generates an error and shows error code and the error description

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|444033236
Comment=STRINGLIST
ContinueOnError=INTEGER|1
ExternalName=STRING|"Task1"
Hide=INTEGER|0
ID=INTEGER|-1400673674
LogOnAsUser=INTEGER|1
Name=STRING|"error demo"
OnErrorTaskID=INTEGER|1879502808
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|0
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER

[Actions\Action1]
ActionID=STRING|"A_FILE_TEXTWRITE"
Enabled=INTEGER|-1
Name=STRING|"Create text file {TempDir}\test.cmd"
Params=FOLDER

[Actions\Action1\Params]
encode=STRING|"0"
fileexists=STRING|"0"
filname=STRING|"{TempDir}\test.cmd"
line0=STRING|"exit /b 1"
linecount=STRING|"1"
suppress=STRING|"1"

[Actions\Action2]
ActionID=STRING|"A_GENERAL_RUN_PROG"
Enabled=INTEGER|-1
Name=STRING|"Run ""test.cmd """
Params=FOLDER

[Actions\Action2\Params]
ifnonzero=STRING|"2"
program=STRING|"{TempDir}\test.cmd"
runas=STRING|"0"
wait=STRING|"2"

[Actions\Action3]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER

[Actions\Action3\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{IsError}"

[Actions\Action4]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Error!!!"""
Params=FOLDER

[Actions\Action4\Params]
icon=STRING|"3"
msg0=STRING|"Error!!!"
msg2=STRING|"Error code = {LastErrorCode}"
msg3=STRING|"Error description = {LastErrorDescription}"
msgcount=STRING|"4"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action5]
ActionID=STRING|"A_FLOW_ELSE"
Enabled=INTEGER|-1
Name=STRING|"Else"

[Actions\Action6]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""No error"""
Params=FOLDER

[Actions\Action6\Params]
icon=STRING|"1"
msg0=STRING|"No error"
msg2=STRING|"Error code = {LastErrorCode}"
msg3=STRING|"Error description = {LastErrorDescription}"
msgcount=STRING|"4"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action7]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
2-nd exanple. It works without errors and shows variable names instead of its values

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|444033236
Comment=STRINGLIST
ContinueOnError=INTEGER|1
ExternalName=STRING|"Task2"
Hide=INTEGER|0
ID=INTEGER|103095842
LogOnAsUser=INTEGER|1
Name=STRING|"no error demo"
OnErrorTaskID=INTEGER|1879502808
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|0
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER

[Actions\Action1]
ActionID=STRING|"A_FILE_TEXTWRITE"
Enabled=INTEGER|-1
Name=STRING|"Create text file {TempDir}\test.cmd"
Params=FOLDER

[Actions\Action1\Params]
encode=STRING|"0"
fileexists=STRING|"0"
filname=STRING|"{TempDir}\test.cmd"
line0=STRING|"exit /b 0"
linecount=STRING|"1"
suppress=STRING|"1"

[Actions\Action2]
ActionID=STRING|"A_GENERAL_RUN_PROG"
Enabled=INTEGER|-1
Name=STRING|"Run ""test.cmd """
Params=FOLDER

[Actions\Action2\Params]
ifnonzero=STRING|"2"
program=STRING|"{TempDir}\test.cmd"
runas=STRING|"0"
wait=STRING|"2"

[Actions\Action3]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER

[Actions\Action3\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{IsError}"

[Actions\Action4]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Error!!!"""
Params=FOLDER

[Actions\Action4\Params]
icon=STRING|"3"
msg0=STRING|"Error!!!"
msg2=STRING|"Error code = {LastErrorCode}"
msg3=STRING|"Error description = {LastErrorDescription}"
msgcount=STRING|"4"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action5]
ActionID=STRING|"A_FLOW_ELSE"
Enabled=INTEGER|-1
Name=STRING|"Else"

[Actions\Action6]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""No error"""
Params=FOLDER

[Actions\Action6\Params]
icon=STRING|"1"
msg0=STRING|"No error"
msg2=STRING|"Error code = {LastErrorCode}"
msg3=STRING|"Error description = {LastErrorDescription}"
msgcount=STRING|"4"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action7]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"

Save the text of the task to a file and use menu Task->Import to import the tasks into RoboTask.

I tried this with Send Email action. It works too.

Re: Task status email notifications

Posted: Thu Apr 27, 2017 2:31 pm
by elwayfan446
I am not sure I follow how to apply this to my task.

Step 6 in my task (the .cmd step) certainly fails. If I choose to show the error in the advanced tab, it pops up on the screen. What I can't figure out is why that error won't carry over into steps 7 & 8 so that step 8 email will send the error description. It can't be skipping to step 10 email because I don't include the variable in the body of that email.

Re: Task status email notifications

Posted: Thu Apr 27, 2017 2:47 pm
by Oleg
Send the full log of the task to me please.

My examples shows that everything works.
If you don't see the error description then this means that error was absent.

Re: Task status email notifications

Posted: Thu Apr 27, 2017 2:56 pm
by elwayfan446
Won't let me attach a text or log file.

Re: Task status email notifications

Posted: Thu Apr 27, 2017 3:12 pm
by Oleg
To email
oleg (at) robotask.com

Re: Task status email notifications

Posted: Thu Apr 27, 2017 3:24 pm
by Oleg
also you can compress log file to ZIP file and attach it to your post here