Run Task Only If Previous Task Had Output - VisualCron - Forum

Community forum

MattMcNabb
2017-02-06T15:50:36Z
I'm having trouble figuring out how to use task conditions successfully in a job. I have a job with two tasks:
1. run a script that outputs some HTML
2. send an email report using that HTML as the body

This works fine, but if certain conditions in the script aren't met, then I don't output anything. In this case I'd like to prevent the email report from sending. I set a condition on this task to only run if the previous task's output contained an HTML tag, but the second task still runs and sends a blank report. I've attached a screenshot of the condition configuration.

please let me know if I'm going about this the wrong way. Thanks!

Untitled.png
thomas
2017-02-06T19:12:59Z
Can you add an image of the Actions tab also?

MattMcNabb
2017-02-06T20:06:11Z
Originally Posted by: thomas 

Can you add an image of the Actions tab also?



Sure! It's just the defaults so I don't believe this part is the problem:


Untitled.png
thomas
2017-02-06T20:39:47Z
That looks correct to me. My guess is that you add the condtition to the wrong task:

Capture.PNG

In this example i output <tabl> in the first task. (wrong spelling). The second task (with the condition) does not run. If I write <table>, all three tasks run.

Have you added the condition to the first task?
MattMcNabb
2017-02-07T12:37:23Z
Originally Posted by: thomas 

That looks correct to me. My guess is that you add the condtition to the wrong task:

Capture.PNG

In this example i output <tabl> in the first task. (wrong spelling). The second task (with the condition) does not run. If I write <table>, all three tasks run.

Have you added the condition to the first task?



Ok, this appears to have been the problem. I had a basic misunderstanding of how the conditions are created and applied. To create the condition I double clicked on the desired task and added the condition with the appropriate settings. It didn't seem to take effect. Now that I've dug a little deeper I see that all I've really done is created a condition without actually applying it to a task. So all I had to do was check the box next to the condition to apply it to the right task and it seems to be working now. Thanks for your help!
Scroll to Top