[MUSIC PLAYING]
CHRISTIAN SCHALK: Hello, and welcome back
to the "Building with AppSheet" series.
I'm Google Developer Advocate Christian Schalk,
and this is the second video of a two-part series covering
actions and workflows.
In this video, we'll now focus on workflows.
Let's dive in.
Recall that AppSheet actions and workflows control
the overall behavior of an application, where actions
enable application operations involving UI, data,
and/or third-party integrations, and workflows
provide rules for automatic execution of actions
via either data updates or when scheduled to run.
To better understand how actions and workflows work together,
here's a diagram that represents their key components.
You'll notice that workflows encompass both tasks
and reports, where tasks are the operation that workflows
can trigger and are essentially the same as actions,
but only execute when data changes occur.
Reports are just workflows that are
scheduled, as opposed to being triggered via data changes.
Workflow tasks are of the following types.
Number one, notifications such as email, SMS, and mobile.
Two, data changes.
Three, webhooks to a third-party web service.
And four, for document creation.
As mentioned, reports are simply workflows that are scheduled.
Besides scheduling when to run, they
are constructed essentially in the same way
that regular workflows are.
Let's switch to the demo app now and build some workflows.
So here we are in our demo app from the prior video,
and this is where we created several actions
to enhance the functionality.
I'm now going to click on the Workflow tab here at the top,
and we're going to create a workflow rule.
So I can create it from scratch right here,
or I'm just going to go ahead and select the Add Email
Automations.
And then what this does is it gives us three example email
automations-- one for change value and removal,
as well as additions.
So since I only want to focus on the additions,
I'm going to delete these first two.
And then that leaves me with just the additions.
And then all I have to do is just
double-check a few of the things here.
Yes, it's going against Tasks.
The update event is just for adds,
so that's exactly what I want.
And then I go into the Do This section,
and that has this task here, the Email Task.
And so this is already set up a default manner.
It's going to send an email to the owner of the tasks
email, that is.
And then it has, essentially, both the subject
and an email body that's given to me already for free.
Now all I have to do to run this is save it and then just create
a new task, and that will actually send an email
to that particular owner.
So this will work, and I've already
shown how that works in the previous "Working With Data"
video.
But for this one, I'm going to go ahead and enhance
it a little bit more.
So just to show you, I can actually
create an attachment of type PDF.
Then I can specify a template for the attachment.
And to do that, all I have to do is click Create,
and that will give me a new blank or a new template
document, which I can then customize.
So there we go.
We have our new template document.
I'll click on View.
And here is our template, and I can customize it
however I want.
So maybe I want to change the color or something like that.
And then that's about it.
There we go.
There.
So now I have my document that's a template now.
And so when the workflow runs, it will use that template
and attach it to the actual email.
So let's go ahead and hit Save.
So that's just like a slight variation
off of the previous workflow that I had showed earlier
in the video--
in the previous videos, that is.
So let's go ahead and test it.
So I'm going to click on plus in the app.
And then I'm just going to say Test Workflow.
And let's leave everything as-is.
I'll go ahead and specify the Owner--
or the task owner, that is.
And I'll hit Save.
And so that will persist it over to the backend data
source, my spreadsheet.
And then let's just go over to the email,
and I'll just wait for the document
to get generated and sent.
And there we go.
We have our email that has come in.
And you can see it has the standard text that I
didn't really change.
But then more importantly, here is the actual attached PDF
report that was based off of that template.
And there we go.
We have our custom-made template or report
that was generated into a PDF.
Anyway, pretty cool stuff.
With minimal action, I be able to create this little workflow
that sends a PDF.
So that's pretty much it for what
I wanted to show for this particular workflow.
I'm going to click over to Reports.
So let's briefly walk through how you would create a report.
So similar to before, let's go ahead
and generate a default report here.
And if you recall, the reports are just
like workflows, except they're triggered not on data updates,
but instead, you schedule when you want them to run.
So here you can see there's a scheduler where
I can specify when I might want to run the report.
And then for the actual fulfillment of the report,
you have a very similar mechanism where you set tasks.
And here's the default one that it gave me,
but you can do essentially the same types of tasks
that you would do with a regular report.
That's pretty much it for what I want
to show for how you would set up a report for now.
I'll show more later in future videos.
This concludes the two-part Actions and Workflows episodes.
For more info on AppSheet, Google Cloud, and Workspace,
check out the links in the description below.
And for more videos like this, make
sure you subscribe to this series so you don't miss out.
Thanks for watching.
[MUSIC PLAYING]