Resource – Live Events- Automate Repetitive Actions With Tasks

Video Synopsis

  • Tasks
  • Task – Generate a simple report as an attachment
  • Task – Expiration notifications
  • Task – Changing Status to False
  • Task – Changing Status to Expired
  • Pricing Plans and Classes
  • Conclusion

Speaker

Ned Pajic –

Hey welcome everyone. To another episode of Caspio labs. This is net from Caspio. Hope you guys are having a good day. Before I begin as always, if you guys can do me a quick favor, let me know that you can hear me okay. And we can go ahead and begin today’s session. Just let me know if my audio’s working correctly and we will go ahead and begin once again. Welcome everyone. Good to see many of you come back to my live streams loud and clear. All right, Steve. Thank you. Feels good. Josh Darlene. Hey, welcome back guys. We have a lot of good content today. We’re gonna talk about tasks. We haven’t done a session on tasks yet, and tasks are very useful when it comes to automating, um, procedures in the back end, just like triggered actions. They allow us to fire and action based on a schedule.

Tasks

If you’re running a task daily or weekly or monthly, it’s going to check in the database on the backend and perform that action based on a specific time frequency today, we’re gonna look at five different examples and most of examples that we’re gonna look at today are going to be basic to intermediate level. We’re definitely gonna do two sessions on tasks, just like we did triggered actions, but I wanted to do more of an introductory course on tasks for people who’ve never done it before, and I want to make it easy for them to understand. Then next time, maybe in a few weeks, we’ll do one more session slightly more advanced functionality surrounding tasks. let’s take a look at my account here and see what we have. I have two different tables created. The tables are completely independent from each other.

 

They’re not connected in any way. What I wanted to do is replicate for you guys today, how we handle our training sessions. If you guys have attended our live sessions in the past, we had them Tuesday, Wednesday, and Thursday. You’re gonna get an email reminder a day before, and also an email reminder one hour before the actual class to let the student know, Hey, there’s an upcoming session. Don’t forget to mark your calendar so you can attend the class. We’re gonna do that as our first example today. Let me show you how we handle that. I have a table here for training membership. If I open up my table, we’re gonna be able to see two members. We have the date and time inside a table. We have the email and we also have the phone number. I’m not doing an SMS notification today, but you can just as easily do an SMS. If you have a valid phone number today, we’re gonna just do an email notification. If it’s one hour before 10:00 AM we send out email, or if it’s a day before the actual session date, we’re also gonna send out email using a task.

 

First one we’re gonna look at is day before. let me hit edit. And what we’re doing here is we’re gonna run that task day before the actual training class. You can see I’m running the task on Monday, Tuesday and Wednesday because the classes are on Tuesday, Wednesday, and Thursday. We need to run that task one day before. When I click on this dropdown, you can run that on demand. If you’d like on demand is you push a button or push a link and it’s gonna run that task on demand. But when you configure, you can set it for specific days. You can see I’m running the task on Monday, Tuesday, and Wednesday. We’re gonna run that task at 10:00 AM Pacific time. Alright, you can also run this daily, monthly, hourly, or once, but I have set my frequency to be the day before then.

 

I included my sent email element here inside a canvas. Here’s my sent email. We’re gonna select from the membership table, the table that we just looked at just a moment ago. We’re doing a simple comparison here between two different elements. We’re basically running the difference in days from today’s date and the session date’s selected to equal to one. That basically it’s calculating one day before the actual class and today’s date. If it equals to one, which is one day before we’re gonna send out email. Now, the one that I have underneath here is optional, but I actually like to include that for more accuracy. I have the field dates selected our equals to 10, which basically means the session is gonna start at 10:00 AM. If it counts to one day before the actual session dates selected, which is one day in advance, it’s going to send us email reminder.

 

Very simple task here to run it the day before at 10:00 AM. If it calculates one day before the actual dates selected for the session itself, it’s going to send out email. The second one is to send that email an hour before the session. Not the day before, but one hour before. Let me open up that as well. It’s very similar to the one that we just looked at. Now, we’re gonna run the task on Tuesday, Wednesday, and Thursday, which is the day of the session. It’s gonna run that task at 9:00 AM Pacific time, which is one hour before the actual class begins from the same table. Again, we use the same and logical operator to calculate the number of days between the session, date and a timestamp, which is equal to zero. Okay?

 

There’s no gap in days in between today’s date and the session date. It needs to be on today’s date, same thing. Session dates selected hour equals to 10. It’s gonna run it at 9:00 AM one hour before, and it’s going to send this email reminder, Hey, your training starts in an hour, but you can customize that message to read whatever you want. This is how we handle our training classes that you see on our website. If you have signed up and received that email in the past, this is exactly how we do that to send that email notification one day before and one hour before, very useful. If you’re looking to send a reminder for any, maybe it’s an event you can run that on demand. There are many different use cases that stem from this type of a workflow.

 

Task – Generate a simple report as an attachment

 

Let me show you another example that I have under task is how to generate a simple report as an attachment. It’s not a true attachment, but it actually takes to table data. And it paces that data inside a body of the email in a report format. If you wanna send an attachment, a true attachment, you’re gonna have to use data pages, but with a task you can include all the table data inside a body of the email to be sent to maybe an executive or a CEO or somebody at a higher level, either on demand daily or monthly, depending on the frequency. I set mine up on demand. I’m gonna click edit, and this is gonna be based on the same table that we just looked at, which contains two entries. We have John and we have Ned. The first thing that I did was I set my task to run on demand.

 

Now I could configure that to run monthly or daily or weekly, but I wanted to do on demand. I can show you when I click on run a task, how we get to email with all the information from the table, then I set up my variable, I set up a table variable here. It is called sample. I grab my data from the table membership. I’m including all the fields from that table. This variable here basically called sample includes all the data from my table and I’m including this variable inside a body of my email. It’s a very simple report that’s generated that gets sent to this email address. There’s my subject line and I’m using some simple CSS that when I generate that report in the body of my email, it creates the border around my table. We have the border around the table and on all the cells within that table. All this information that you see here is going to be included in the body of my email. Let me show you let’s run this task. I will simply run that now and let me go to my email and wait for that email to come in.

 

I think I received it. Let me include that here. Here’s the email they came in. All the information from that table, we were able to include as an attachment inside a body of the email. If you’re looking to send emails to your executives on demand or monthly at a specific time frequency very, very helpful. I’ve done this before in some other examples where a CEO or some other level wanted to get an email generated with all the most recent data, which you can do as well. This is grabbing all the information from the table, but you can specify if you only want the most recent ones, you can also do a conditional where you include a where clause to only send that data based on a condition. If you’d like, I decided not to do that just for simplicity. Let’s go and exclude that and just move that back into the trash can.

 

Let me know if there are any questions, if this is all making sense so far before I show you my other two examples today’s session is not gonna be very long. We’re only looking at basic to intermediate setups and as always, I will make these available in the description of the YouTube video later on. You guys can download them, import them into your account and you can see how I did it. If you wanted to repurpose that or use it in your own use cases, hopefully everyone is following along. With all the use cases that we’ve seen so far, like I said, it’s very basic, but in a few weeks, we’ll do another session on tasks with some more complex examples. We have two more examples to look at this fourth. The fourth example that we’re gonna look at Is based on this user membership table.

 

Task – Expiration notifications

 

What I would like to do is send an email to a user seven days before their expiration expires. Okay? So we have a yearly membership. I would like to send an email seven days before that yearly membership expires to let them know, Hey, your membership is expiring. And if it does expire, I want to make their account unchecked or inactive. Let’s say they haven’t renewed their membership automatically unchecked the box. This user can no longer log into the application. And this is very common in a SAAS type environment where your customers sign up, they’re using your services that you have, and if they don’t pay you make them inactive, but you send them an email as a courtesy email, letting them know, Hey, your membership is about to expire. Okay? Here in my table, we have myself, we have the email, we have the account status to be checked and we have the date registered, which is, well, I set it for tomorrow now under tasks. Let me edit so that you can see this one here as well. For this task, you wanna run this daily because you can have multiple members inside that table. You wanna make sure you’re running that task daily. It’s checking against one year, seven days before the year expires. We select the data from that table that we just looked at. And again, we’re gonna use the where clause and logical operator where the difference in days,

 

Sorry, let me just think for a second here. This is not different in days on a second. This is different in years and we want one year, I thought I set that up correctly. Difference in days here.

 

The difference in days between today’s date and one year from the registration date should equal to seven. That means we’re calculating seven days between today’s date and one year from the registration. Hopefully that makes sense. We’re just adding seven days. As you know, before the, year expires from today’s date and the expiration date, and we also want the account status to equals to true. If it’s still an active account, we wanna send out email, which is right over here. The email basically states your account will expire in seven days. You can customize that email to say something more comprehensive or something more informative. But for me, I just included a simple text there. Then, also at the same time, we wanna update the user membership table and change the account status to equals to false. I did not set this up correctly. Let me just make sure this is correct one year. Now if the days from today’s date and one year after the registration date equals to zero, now that one year has expired, then change the status to false in the table.

 

Task – Changing Status to False

 

That’s another example how you can handle memberships. You might add some other rules to this task as well. Especially if you have payments integrated with your applications. There’s probably a few other things that you could potentially add here. If the payment doesn’t go through, check against that as well. Also, change that to false. If the payment doesn’t happen you can also add additional emails here to go out maybe a day before the expiration date expires. You can do that as well. Just as a courtesy. That’s our fourth example. For our final example, I should have saved that I’ll come back here and fix that later on so that you guys, when you download these you have the correct, actually, why don’t we do that right now?

 

Let me make sure I do this correctly days. One year.

 

Calculate seven days. That’s correct. Then one year and let’s make sure we save that.

 

It didn’t allow me to save it. I’ll have to figure out why it’s not allowing me to save that. Maybe I should validate first. Let’s try one year and one year maybe because my data is not accurate in the table. That’s probably what it is. User membership, user membership. That time it saved it. Good. Alright. Let’s take a look at one last example, which I have in a different application. Let me change. Let’s go to all assets tasks, and we’re gonna look at class expired.

 

Task – Changing Status to Expired

 

This one is using a joint between two tables, because we need to grab the information from another table so that we can use it in the email. What we’re doing here is running the task daily at 5:00 PM to update the table of classes and change the status to expired if the date of class expires. So it’s checking against today’s date. If it passes that expiration date, where we want to change the status to expired in the table. So that class is no longer visible on the front end. Okay. Just imagine you have a public listing of all the classes people are signing up for those classes. If the date happens to expire, we want to remove that class from visibility and not be able to show it.

 

Pricing Plans and Classes

 

Please mention which pricing plan contains this. We’ll take a look at it. I’ll need to go to our pricing page a hub and figure out which plans do have the tasks. Good question. And at the same time, we’re sending an SMS the day before the class begins to notify the user, Hey, your class is happening tomorrow. Make sure you do all the due diligence prepare for the class so that you’re ready for the session. But in order for us to include some of these fields, you can see them including the customer first name, the title from the classes table, also the address and also the business phone number. You can see, I have to join some tables together. Select from the customer table. We send the SMS select from the customer table where we joined a table of customers to the table of registrants so that we can grab the information so that we can include that information. We’re also joining the table of classes here with the registrants so that we can not only grab the class’ date of class from the classes table. That’s how we’re able to calculate the difference in days from today’s date. One day before today’s, before the actual class send that SMS and then we can include the customer business phone number and you can also have the class title and class address because we are joining to the classes table so that we can pull that information from that table.

 

Every time you want to include information from other tables inside your trigger here or inside a body of the email, you have to join the two tables using join. As promised, as I said, I will make all of these available for you guys to download by the end of the day or maybe by midday tomorrow, depending on how much time I have today, I will make them all available for you to download. You can include them in, you can import them into your account. You can see how I did it, you can quickly replicate that and learn from but let me answer that question in terms of pricing, because I, myself could probably benefit from knowing that. Let’s look for tasks email, send automatic emails from your apps and tasks. Let’s see if that’s the only one that I have. Let me just see here. SMS notifications from tasks are on the build plan, application tasks, custom logic, and workflow, and run on, on demand based on the pre. This is the one. Really it begins on the build plan if you want to use the task feature.

 

It will begin on the build plan. Not included on the Explorer plan, not included on the free plan, but it is included on the build plan. Right? I do suggest that you speak to your account rep for even more details on that because my hands are tied when it comes to pricing. I don’t have no control over that. Thanks Brian, for the feedback. Let me take a look in a task, call another task. Can I call, can a task call another task if I run a task? That’s a good question.

 

I think about that because I’ll be honest with you guys. I don’t spend as much time in the platform as I used to and tasks and triggers. I would rate myself seven out of 10, six out of ten seven, because I don’t use them as much in some of the demos that I build. Even my knowledge on that subject is a little intermediate, I would say, but I will get an answer for you. If you can do me a favor, just send me an email FB serve. I know you’ve been there in the past. Welcome back. If you can just shoot me a quick email with that question. I will definitely get an answer for you. I don’t wanna give you a wrong answer. I don’t wanna over promise. Just do me a favor. Send me an email if you have it, if you don’t, I’ll send you an email and then we can find an answer together.

 

Can you run a task to auto update a table with data auto update a table with data? I believe so. Let me just think about it for a second. An example like batch job. I did something like that for our triggers while do. I’m pretty sure that you can just theoretically thinking about it. I’m pretty sure that that’s possible, but this is Darlene, right? Yeah. Darlene. I will, I have your email Darlene. I just wanna verify, validate that it’s correct, but I’m pretty sure that you can, but I’ll have to look into that. I wanna give you the, I don’t wanna give you the wrong answer, I will find out for you and I will follow up on that. I’ve done that before. Like, if you’re running a schedule, I’m just thinking about it. If I run on demand and if I do combine that with wild do to loop, I could update another table. I’m pretty sure that’s possible.

 

That has to be possible. Cuz I did something very similar with the triggered actions. Even with the task, even if you’re running this on a schedule like daily or on demand, you run the task, check checks against something and then in a completely separate table we can run an update on another table, like a batch update, right? If I check a box in one table, let’s say you’re running the task daily and if you check something on the front end, now it’s in the table. There’s no reason why the other table cannot process a batch based on that previous table. Just thinking about it out loud, I can see it happening, but I’ll confirm for you and maybe I can, if you gimme just a simple example of what you would like to do in an email Darlene, I will put together a small demo for you and you can let me know if that’s what you were hoping to, to achieve. I know that I tell you guys to email me. I will get to all the emails because I am receiving a lot of emails lately and I just haven’t had the time to respond to many of them, but rest assured I will eventually get to it. It usually takes me about two or three days. It’s just that I have so much more on my plate but I definitely make it a habit to come back to that email and respond.

 

Conclusion

Cool beans. Well that’s all that I have for you today. Very short class in a few weeks, we’ll do round two on tasks and we’ll look at some more complex examples. We’ll take a look at it. I’ll show you something that I worked on it previously. Let me just change accounts here very quickly and let’s go to all assets, let’s go to tasks and then we will look at something a little bit more complicated, but I don’t want to overwhelm anyone today, with a complex task that includes if and then, and do only because a lot of people haven’t configured any tasks in the past. I like to break that up in two sessions, do more basic to intermediate and then some more advanced tasks later on. Versioning on the feature list for tasks and or triggered action, similar to data pages. I think you’re talking about revisions on data pages, right? If I’m not mistaken, do a revision history, but you want the same thing for tasks that I do not know tasks and triggers.

 

I do not know, although that would be a, I can see that being very useful to revert back to what you had before. It’s another one of those where I have to ask the engineering team only because I don’t have too much visibility on what happens with the product map, roadmap. You’re welcome, Darlene. If you can combine the first question with the second one in the email, I’ll look at both of those for you. I know that idea box is usually where people suggest what they would like out of the product and then people, other people will vote on that. I know that our engineering team places priority under ones that get the most votes and that’s what gets added into the funnel for future releases. I will share this link with you guys as well. If you haven’t seen it before, I think you can also access this within the account too, if you go under help. I idea box. Same thing

 

I like to test, but have to use naming conventions and it gets ugly yet. Been there, done that. Believe me trust me. That’s why I always make it a habit to add a familiar prefix before each one of the objects that I developed. If this application was a CRM, I will add a prefix CRM to all of my objects that I create. It’s easier to find, especially when I go to all assets and I look at all of my tasks across all of my applications. At least, I can find that prefix and know what application it belongs to. Ask for naming convention. I always recommend people to add that prefix before the table name, before the view name authentication or any other object in the account, except for data pages, data pages, you don’t have to all the other objects, objects. I strongly recommend that you put a prefix in front.

 

I hope you enjoy today’s class. I will go ahead and leave the chat open. And as I said, I will make all of these available to download at the end of the day or some midday tomorrow in the description of the YouTube video. You can quickly download it, input it into your account and you can always refer to it if you need help building out these tasks. Much easier than having to reinvent the wheel or build from scratch. If you already have it available and you can quickly just piggyback on top of it or copy and clone it into your own application. That was a good recommendation from somebody in the previous live stream to make these available as downloadable links. Thank you for that. It’s been very helpful and a lot of people are finding that helpful because it’s another good resource and a good way to learn Caspio especially if you are like me, the database background is not as strong as the front end background.

 

Thank you all. Have a good day, have a good week. I hope to see you next week as well. Next week we are actually, let me just share the topic for next week. We are talking about scheduled import and export so we’re gonna look at how to connect to an online repository such as Dropbox. I might also include Google drive and a few other ones FTP, definitely. How you can use update, how you can use append replace to include into your automation. Very helpful. If you’re looking to connect to an FTP and you’re continuously adding files to your FTP drive, so you can send out PO there automatically to bring the new data sets into your tables and make them available for your end users the next day. That’s the next topic for next week and I’ll see if I can do some advanced things with that. You will also see, I don’t know if you noticed, if you ever played around with our RMAs app templates, what we’re doing is running a task scheduled import every hour to refresh the data, right? Cuz a lot of people when they access these applications, when they’re doing demos, what they end up doing is they’ll login, and They’ll add a new article.

 

They’ll fill out this form, hit submit and a lot of people add, you know, just test data, dummy data. What we do with that task is we refresh this data every hour. When people log in and they’re looking at this RMA, it looks like nobody touched it before. All we’re doing is going into either Dropbox or FTP. I don’t know which one it is. We have the original data set as a workbook file inside an FTP drive. We just replace all the tables with data from that FTP drive with the new with the original data every hour we do that. Next time people are looking at the articles and they hit search. They’re not gonna see test data. They’re gonna see actual data, the original data set that we had Google drive would help for. I can see, I can see about including Google drive. Second, second that. Can we do a class on how to set up records in a table that are separate from each organization? Or if you already did that, then I can check it out separate from each organization.

 

I think we did something like that in the past where I created a, gimme a second. Let me pull this up. I am almost certain that I did that, but I’m just gonna look at all the previous ones in just a moment. Let me bring this back content live.

 

Let me read these really quickly deploying RMA. I am almost certain. I did that in this one here. How to scale your applications with record level security. I’m just gonna hit play here. I did it in this one or let me see, Or it could have been this one.

 

SAAS. I’ll look into that for you Darlene. I’ll send you an email but in one of them, what you do is you set up two tables. You have a table for organizations or companies where each company has its own company ID or organization ID that’s in one table. Then, you have in a separate table, you have all the employees that are linked to that company ID. You’re gonna need to duplicate that company ID in the SEP in the separate table for each one of those company employees. We treat that like a one to many, two tables, one table for organizations and one table for employees that belong to each organization and you link that using the company ID or organization ID. Hopefully, that answered the question, but I will send you an email once I figure out where are I know I have, I’ve done this before a video on how to set that up. I know there’s an outdated video as well. Permissions, not that one permissions.

 

This one. I’ll give you a link to the, I know it’s in this one. It’s a little bit outdated, but it’s still relevant. I know I did it in 2016, so it’s a bit of an old video, but I put a time mark here where you can get to a multi-company registration, but a permission starts at the 27th minute.

 

You will have one table for companies. company A, company B, and company C in one table and each company will have its own unique ID, but you need to have a second table for people that belong to each company. You’re stamping the company ID in the user table because each company is going to have many employees or if it’s a one to one where you only have one user for each company, you don’t have many users per company, then you can get away with just having one table where inside a company’s table, you have a username and password for that specific company. Then, you use RLS company ID to filter the data for that company. Um, but I am guessing that you’re gonna have multiple users per company that need to log in, but we’ve done multiple sessions on RLS. If you check out the other video from the live stream, scale, your applications using RLS, that’s gonna answer a lot of your questions.

 

I’m very happy to see the, the live stream growing. We’re seeing a lot more people class by class. I’m very excited about that we wanna build this community. I hope you guys don’t forget to like the video helps grow the channel even more. We love having, you know, people who’ve attended these sessions before come back. Thank you guys for coming back. It means a lot to me. I can tell you that much. Basically tells me that you guys are enjoying the content and you wanna see more of it. If there’s ever a topic on something that we can cover off in these live streams, I am happy to take on that topic. If it’s something that follows within standard features of the platform, if it’s something that requires customization that would have to go through a professional services team especially when it has to deal with APIs connecting to third party software, sometimes we can get away with it using Zapier. If Zapier does have that application available in its library, we can do that. We’ve done two live streams on Zapier before. Everything that we do in live streams is all about standard features plus or minus sometimes we’ll talk about HTML, CSS and JS. Yes.

 

Thank you, Ali. I appreciate the feedback. Thank you guys so much. Have a good day, have a safe week. Hope to see you next week on Monday for our next topic and until then be well, all right. Bye. Bye.

Build Feature-Rich Database Applications Without Coding
GET STARTED FOR FREE

Next Steps

NEW IDC WHITE PAPER
See why low-code developers are growing 3x faster than traditional developers.
TALK TO AN EXPERT
Have a vision for an application? Talk to a Caspio product expert and we’ll help you achieve it.
SEE CASPIO IN ACTION
Want to see if Caspio is a good fit for your needs? Choose a date and time for a personalized demo.