[DIGITAL EFFECT]
CHRISTIAN SCHALK: Hello, and welcome back
to the Building with AppSheet series.
I'm Google Developer Advocate Christian Schalk.
And in this episode, we will build
on what we started with the tasks demo application
from prior episodes by introducing
common ways to work with data in AppSheet
using Slices and Workflows.
So in this episode, I'll extend the tasks demo application
by adding the following.
I'll first show how to create a Slice
and configure it to show only my tasks that
haven't been completed yet.
I'll then introduce a Workflow rule to automatically
send an email to the task owner as a new task is created.
Before jumping into the demo, though, here
are a few more details on Slices and Workflows.
AppSheet Slices allow you to filter data from a source table
down to a subset of rows, columns, and actions.
They're useful when you need to show a customized Slice of data
in an application, for example, when you want to only show
rows that match a user's email as needed
for a custom My Tasks view.
Building Slices is easy in AppSheet,
as the Slice's editor pane allows
for their quick construction and immediate testing,
all without requiring any code or knowledge
of structured query language.
AppSheet Workflows allow you to define automated behaviors
when data is changed.
The Workflow action specifies what the Workflow does, and can
perform either a data change operation, such as adding a row
or updating a cell, or an external communication
using a variety of methods, including email, SMS,
mobile notifications, and even webhook
calls to third party services.
Now that we've covered some more basic AppSheet concepts,
let's return to our tasks demo and extend it further
with Slices and Workflows.
So to show Slices and Workflows in action,
we'll return to our task demo application
from prior episodes.
And we'll see that we have our two tables, tasks and owners
that are now related via references,
and the UI is seamlessly linked together.
So as you can see, I can click on a particular owner
and I can see their respective tasks.
Everything looks correct.
And the application is functioning perfectly fine,
but now let's go ahead and introduce
a new Slice that will allow me to filter some of the data
results that I see.
So in this case, when I click on Tasks,
when I look at the task view, I see all the tasks.
But I'm going to introduce a Slice that
will allow me to filter the tasks to only the task owner,
and also, I'll filter out the non-complete or basically
filter out any tasks that have already been completed.
So let's go ahead and do that.
So to do that, I click on the Slices tab here.
And that's under the main data tab.
And I can click on New Slice.
Incidentally, I could also select
some of these other time-saving options, but in this case,
I'll just create a new Slice from scratch.
And I'll call this Slice My Tasks.
I'll base it off of that same source table.
And I'll set up the row filter condition.
Incidentally, there are other options
where the columns or the actions or I
can specify to go along with the Slice.
But in this case, I'll go ahead and accept the defaults.
So I don't necessarily need to override or change anything
here.
So for the task Slice, I'm going to have a row filter
condition that'll allow me to specify that I only
want the tasks that belong to the current user.
And so I do this by adding this one little check
here that says the owner column has
to equal to the same currently logged in user.
And that just matches their user email.
So click Save.
And I can click on the larger save operation here.
And so you'll notice, I still see all the Slices.
So how do I make it so I actually see the change?
So in this case, I'm actually looking at the main task view.
And that's the one that I need to re-plug into these Slices
data.
So in this case, I'll open up the tasks view.
As you can see first off, for this data,
it means which table or Slice to display.
I just change that now to My Tasks.
I can also update the title here of the name.
So it's going to be My Tasks from here on.
So there we go.
Now we can see our updated UI.
It now has the-- once it syncs, give it a second-- it now
has My Tasks name.
And it also has just specifically My Task.
And I can verify this by going back to the source spreadsheet.
So if I see the source spreadsheet,
I see specifically three records here,
which I'll match up with while we're
looking at it in the actual application.
Now, for the second thing that I want to do,
is I want to restrict it further.
I want to make it so that the non-complete tasks only show.
So anything that's complete, I don't need to show that.
So to do that, let's go back to the Slice definition.
So I go back into Slices.
And then we have My Task Slice.
And I'm going to update the row filter condition.
So for this one, I'm going to introduce
an and function, which will allow us to evaluate
two expressions together.
And for this one, we just need to set the status
to not equal complete.
And I close that off.
And so now we have an and function,
which puts together the two expressions in one shot
and evaluates it together.
So I'll click Save.
And then I also go ahead and hit Save here.
And once everything synchronizes,
we should see that complete task disappear.
And there we go, it's no longer there.
So in just a few steps, I was able to create a Slice that
gave us our desired behavior to filter down
to only My Tasks and only My Tasks
that have yet to be completed.
All right, so let's move on to Workflows.
Now, for Workflows, that allows us to change the app such
that it will also send an email to a new task owner.
So to do that, let's click on the Behavior tab here.
And under behavior, you'll see that there's
a Workflow section here.
So I click on Workflow.
Now, I could create a brand-new Workflow rule from scratch,
but in this case, I'm actually going
to use this option to add email automations for records
and tasks.
And that's essentially what we need to do.
We just want to automate, essentially,
or set up the email to be triggered off of any record
changes or additions to tasks.
So I'll click on the option.
And it gave me two options here--
or gave me two Workflows or two tasks, that is.
And so I don't need to act on any change values here.
So I'm going to go ahead and delete this one.
But I will keep on additions to tasks.
So I'll leave that as is.
And I can even say notify task owner.
And then I can just kind of walk through some of the options
here.
So the target date is still tasks.
Update event, adds only.
So that's what we want to do.
If this is true, that's just another evaluation
to see if there's any kind of other thing
we want to double-check.
And then finally, here's the actual action that we want.
In this case, it's already built for me a ready to run action.
I just need to customize it.
So first off, I'm going to go ahead and delete the two
and I'm going to insert an expression.
And the expression will simply be the owner's email.
So again, I can just go owner.
And I could use just the owner by itself from the tasks table
perspective, or I can reference it
from the actual owner's table.
So in this case, I can say owner.email.
And so this is a very helpful tool
if you are wondering how to reference fields
from related tables.
So that all evaluates to correct.
Let's update the Workflow action name while we're at it.
So let's go ahead and say send email to task owner.
If I can type it.
And Incidentally, you'll see that I
have all these other options.
Notify, SMS, webhook, change data so far.
I could select those.
But for now, I'm going to keep it only to use email.
And then now it's just a matter of updating the email subject
and body.
So I'll just change this to say, attention you have a new task.
And maybe I'll just copy that and put it into the body
as well.
So I'll open up the body a bit more for more room
to work with.
And I can delete out some of the stuff that I don't need.
I'll just leave this, because it was auto-generated for me,
but it is using the correct way to reference
with those extra brackets around the column names.
And so I'll just leave that as is.
And I'm going to add another bit of text here.
So I'm actually going to add the link to the application,
and I want to point it directly to the task view--
the My Task view, that is.
So to do that, let me click Save.
And I'm going to open up My Tasks in a UX view.
And I open that up.
And under the My Task view, there
is a behavior option here.
And it actually has a link, a direct link to the view.
So I'm just going to copy that.
Then I'll switch back to the Workflow rule.
And so here's our Workflow rule.
I can open up the do this portion,
send email to task owner.
And go back to the actual email body.
And I just paste that link directly into there.
And so that's it.
I should have a fully functioning application
that will notify the task owners that they have a new task.
Incidentally, since this app is not deployed,
the email is actually only going to go to the current app owner.
But once you deploy it, it will actually
look that up and dereference it and send the email
appropriately.
So I'll click Save.
And now we're good to go.
We should be able to, for example,
start from the owner's point of view,
click on a particular user, add a new record.
So in this case, maybe I'll say finish demo.
Maybe give it a priority 1.
And then I'll say, it's already in progress.
I'll leave the default owner.
But I could also overwrite it if I wanted to.
But I'll leave it as default. And I'll click Save.
So now that's synchronizing back to the spreadsheet.
So let's take a look to see if we have,
actually, our new record in the spreadsheet.
So there we go.
We have the new record as it appeared.
And then we also have a new email that came in.
So don't worry about the upper part
here, but basically, we can see we have the information
on the particular task.
And there's the task actual name.
And then we have that link that we've
pulled over from the UX view.
So we click on that.
It opens like a full screen view of the My Tasks view.
And it just so happens to be in this particular card,
the finished demo part.
And I open that up, and I can actually change it.
So I can say complete.
I'll hit Save.
And if I go back to the original spreadsheet,
I should be able to see the in progress
switch over to a complete in about a second or two.
And there we go.
It's now complete.
This concludes the Slices and Workflow demo
for the Working with Data and AppSheet episode.
For more info on AppSheet, Google Cloud
and Google Workspace, check out these links in the description
below.
And for more videos like this, make sure you subscribe,
so you don't miss out.
As always, thanks for watching.
[MUSIC PLAYING]