Solved

Send email based on value from scheduled task

  • 13 April 2021
  • 3 replies
  • 410 views

Badge +3

I created a custom API that returns one of two values (let’s say ‘0’ and ‘1’). It needs to run every four hours. If the value is ‘0’, then an email needs to go out.

While I don’t need help with creating the database task and scheduling it to run, I don’t know how to then get an email to send. Do I make an Event? If so, how do I tie it to the scheduled task? Do I do something else??

Let’s assume the Scheduled Task is named “Neraks_Amazing_Task”.

Thanks!

 

 

 

 

icon

Best answer by EntShehaM 13 April 2021, 21:23

View original

This topic has been closed for comments

3 replies

Userlevel 3
Badge +5

@NerakYak well, you don't need to create a custom event to trigger the email, custom events always bind with table which you create the event for and upon any changes such like insert/update or delete to perform specific action. since you already have a custom package deployed in client environment you can simply create a schedule task to execute every 4 hours as per the requirement.

In your custom package I believe you have a function already written to get the return values (0 or 1) so basically you can create a procedure in the declared custom package and inside that procedure do an IF statement to check your pre-written function returns value is equal to 0 then you can trigger the email sending by using Command_SYS.Mail(). Once in every 4 hours when the schedule execute it will check your return value whether 0 or 1 upon your return value, action will perform (in this case send an email).

Cheers!

Badge +3

AHA! I knew I was making it more complicated! THANK YOU!!

Userlevel 3
Badge +5

AHA! I knew I was making it more complicated! THANK YOU!!

Glad that clarification helps you to fulfill your requirement.