Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


Matt Peden
2017-07-28T00:58:37Z
All;
I have a job that runs every 15 minutes. If the job fails it sends an email to a support group to notify of the issue. I want to build a condition loop that bypasses the email notification if the email has already been sent within the hour. On the job executions in the subsequent hour reset the variable to allow a failed transaction to send the email.
I presume I could create two jobs and have specific job intervals for each where the one that runs hourly sends the email on a failure and the job that runs at the 15,30, and 45 interval will not send an email. That does not seem very elegant and it seems as though with all of the features of VisualCron between Job variables, User Variables, Conditions, and Job Flow that I could do this with 1 job.
I would like a solution that could be used for a job that may run every 5 minutes where the above solution would be very tedious and a programatic solution may be a little challenging.
Maybe this:
- Set a JobVariable to define the interval to check notifications
- on start of the job check a DateDiff of current date against a date UserVariable
- If diff is greater than JobVariable then reset the UserVariable to NULL
- Execute task
- On success flow, check UserVariable is not NULL then go to Reset UserVariable to NULL task and exit
- On error flow, check UserVariable if NULL then go to Email task; otherwise, End Job
- After Email Task set UserVariable to current timestamp

Has anyone done Something like this yet?
What was your solution?

Thanks
Sponsor
Forum information
Matt Peden
2017-07-28T02:55:26Z
Here is what I came up with which is a bit of a variation from the challenge as it is more of an iterative solution not time based. I think it will work for me though.
This will allow me to send 1 email and then if the task continues to fail without resolution for the specified number of executions it will send another email.

Still interested if someone has something different though.

2 Job Variables (NotificationSendOn,ResetErrorOn) to determine notification trigger count and when to reset interative count
1 task with 5 task flow paths based on results and error counts
1 User Variable TesterrorCount
1 Job Flow Control Task (End Job)
1 Calculate Variable Task
1 Email Notification task
1 Set UserVariable task


Steps:
-Perform task
Task Flows:
On success - Goto next Task --> Set User Variable (TesterrorCount = 0) --> Job Control task (End job)
On Error - Goto task --> CalculateVariable task (TesterrorCount=TesterrorCount+1 ) --> End Job
On Error when Uservariable(TesterrorCount)=JobVariable(NotificationSendOn) --> Email Notification --> Calculate Variable (TesterrorCount+1) --> End Job
On Error when Uservariable(TesterrorCount)<JobVariable(ResetErrorOn) --> Calculate Variable (TesterrorCount+1) --> End Job
On Error when Uservariable(TesterrorCount)>=JobVariable(ResetErrorOn) --> Set User Variable (TesterrorCount = 0) --> Job Control task (End job)

Next steps are determined by first tasks flow
- Set User Variable (TesterrorCount = 0)
- Job Control task (End job)
- Email Notification
- Calculate Variable (TesterrorCount+1)
Scroll to Top