Skip to main content
Solved

Send email based on value from scheduled task


Forum|alt.badge.img+4

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!

 

 

 

 

Best answer by EntShehaM

@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!

View original
Did this topic help you find an answer to your question?
This topic has been closed for replies.

3 replies

EntShehaM
Hero (Partner)
Forum|alt.badge.img+5
  • Hero (Partner)
  • 30 replies
  • Answer
  • April 13, 2021

@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!


Forum|alt.badge.img+4
  • Author
  • Do Gooder (Customer)
  • 5 replies
  • April 13, 2021

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


EntShehaM
Hero (Partner)
Forum|alt.badge.img+5
  • Hero (Partner)
  • 30 replies
  • April 13, 2021
NerakYak wrote:

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

Glad that clarification helps you to fulfill your requirement.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings