How can I conditionally activate a response, at most once per calendar day?

Jim G. (15 posts)
October 15, 2024 09:08 AM
Accepted Answer

Preface:

  • I'm inclined to say that I should track my state in a database and write a script to implement this business logic, but I will ask my question anyway.

 

I have two jobs:

  • Job A
  • Job B

 

Problem:

  • When Job A runs between 5 PM and 7 PM, Monday through Friday...
  • And it returns a job return code of 'Success'...
  • It should trigger Job B once and only once for the given calendar day.
    • This is key. It should not trigger Job B more than once for the given calendar day.

 

Question:

  • Should I code this business rule and conditional logic in a script?
  • Or are there ways that adTempus can implement this conditional and business logic out of the box?
    • I'm particularly interested in tracking the number of times that Job A has triggered Job B for the given calendar day.
    • And I would be amendable to querying the adTempus database within the script if that seems best.

 

 

Jim G. (15 posts)
October 15, 2024 10:11 AM
Accepted Answer
And with respect to querying the adTempus database, I'm inclined to say that I should query the [executionHistoryItem] table for what I want.
Bill Staff (609 posts)
October 17, 2024 09:14 AM
Accepted Answer

The simplest way I came up with uses a Job Variable to store the last trigger time, and a script to check that. You could query the job history using the API or directly in the database, but that's probably more complicated than it needs to be.

You can do this with either a Job Control Action in a Response on Job A, or a Job Trigger on Job B. The best approach depends on how you want it to work if Job B gets run other than by Job A (i.e., someone runs it manually). That is, do you want Job B to be run only once per day, or you want it to only be run by Job A once per day, but it can be run other times as long as it's not run by Job A?

Let me know the answer to that, and whether you're using adTempus 4 or 5, and I'll put together an example.